Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: Peter Duggan on October 24, 2004, 11:09:05 AM

Title: Displaying 'news' as forum-wide 'super-sticky'
Post by: Peter Duggan on October 24, 2004, 11:09:05 AM
Since several people have asked about stickies to display in all boards, here's a quick hack (inspired by two suggestions from Amacythe (http://www.simplemachines.org/community/index.php?topic=18626.msg152271#msg152271)) to divert items from your forum news to high-visibility 'super-sticky' positions between the link tree and sub-menu on every message index and/or topic page. While it doesn't currently provide any multi-topic cross-board functionality, it has the compensating advantages of being both extremely simple and absolutely non-destructive.

To display a selected news item as 'forum rules' within every topic:

Search sometheme/Display.template.php for:

// Is this topic also a poll?

And add before:

// Show news as 'forum rules'.
echo '
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="bordercolor">
<tr><td style="padding: 1px 1px 0 1px;">
<table width="100%" cellpadding="3" cellspacing="0" border="0">
<tr><td class="windowbg">
<table width="100%" cellpadding="5" cellspacing="0" style="table-layout: fixed;">
<tr>
<td valign="top" width="16%" rowspan="2" style="overflow: hidden;">
<b>Blah (Forum Rules?)</b>
</td>
</tr>
<tr>
<td valign="top" class="windowbg" width="85%">
', $context['news_lines'][0] , '
</td>
</tr>
</table>
</td></tr>
</table>
</td></tr>
<tr><td style="padding: 0 0 1px 0;">
</table>
<br />';



Where Blah (Forum Rules?) explains the purpose of the pseudo-post and $context['news_lines'][0] selects the news item specified by the array key (NB the first item is
Title: Re: Displaying 'news' as forum-wide 'super-sticky'
Post by: FaSan on December 30, 2004, 04:19:56 PM
Uhmmm... i'm interested at one (or more) thread visible in all board...

If you have a time for it... my time is little now :)


Thanks



FaSan
Title: Re: Displaying 'news' as forum-wide 'super-sticky'
Post by: Jerry on December 30, 2004, 04:59:44 PM
I was thinking about something like a "Global Sticky" that shows in all boards :P
Title: Re: Displaying 'news' as forum-wide 'super-sticky'
Post by: Amacythe on January 02, 2005, 10:58:48 PM
If I'm not mistaken this will work as a global sticky and show on all boards.  It will not be within the actual board but on top of the category name.
Title: Re: Displaying 'news' as forum-wide 'super-sticky'
Post by: Peter Duggan on January 03, 2005, 06:10:08 AM
Yes, that's basically correct except that it's permanently 'open' and you can't reply to it because it's not a true topic. So the MessageIndex.template.php hack is effectively a global super-sticky and the Display.template.php hack an 'in your face' topic level version, but they're more suited to short announcements than long discourses because you can't close them.
Title: Re: Displaying 'news' as forum-wide 'super-sticky'
Post by: Vinspire on May 10, 2006, 04:28:22 AM
Sorry for digging up this old topic but what is this trick suppose to do ?
Title: Re: Displaying 'news' as forum-wide 'super-sticky'
Post by: geezmo on June 21, 2006, 11:59:07 AM
Are the codes in the first post still applicable in 1.1RC2?
Title: Re: Displaying 'news' as forum-wide 'super-sticky'
Post by: etdwh on July 05, 2006, 04:15:46 AM
The code above does not work correctly for version 1.1 RC2. I guess because of the theme the code above is taken from.

Here is my version, for the default theme in version 1.1 RC2

In MessageIndex.template.php, search for:
if (!empty($options['show_board_desc']) && $context['description'] != '')

add the following above it:

//add rules
echo '
<div class="tborder" style="width: 100%;">
<table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">
<tr>
<td width="100%" colspan="7" class="catbg3">Global Announcements</td>
</tr>
' ;
foreach ($context['news_lines'] as $news)
{
echo '
<tr>
<td class="windowbg2" valign="middle" align="center" width="5%"><img src="', $settings['images_url'], '/topic/normal_post.gif" alt="" /></td>
<td class="windowbg2" valign="middle" align="center" width="4%"><img src="', $settings['images_url'], '/post/exclamation.gif" alt="" /></td>
<td class="windowbg3" valign="middle" colspan="5"><b>', $news, '</b></td>
</tr> ';
}
echo '

</table>
</div><br><br> ';
//end add rules


This shows ALL the news items as seperate topics.

Problems:

It works for me so far, im not sure if this will cause any other problems later.
Just to share, hopefully it will be useful to someone.  ;)
Title: Re: Displaying 'news' as forum-wide 'super-sticky'
Post by: PrizeLive.com on July 13, 2006, 09:16:13 AM
Any update on this one for 1.1 RC2?
Title: Re: Displaying 'news' as forum-wide 'super-sticky'
Post by: etdwh on July 19, 2006, 02:18:33 AM
Actually, its available as a mod now. Check out the work done by Jay here:
http://www.simplemachines.org/community/index.php?topic=93129 (http://www.simplemachines.org/community/index.php?topic=93129)

The download is on page 3, but read the other posts, just so you know what you are getting into  ;)
Title: Re: Displaying 'news' as forum-wide 'super-sticky'
Post by: PrizeLive.com on July 19, 2006, 08:36:13 AM
It's not a mod yet though, is it.?
Title: Re: Displaying 'news' as forum-wide 'super-sticky'
Post by: etdwh on July 24, 2006, 03:27:36 AM
Quote from: SurfExcelerator.com on July 19, 2006, 08:36:13 AM
It's not a mod yet though, is it.?

It IS a mod, but a mod in progress  :)
You cant get it from the mods section yet. But if need something now, you could use the currently available "beta". I think it works pretty well, with a minor bug or 2, but does not cause any problems for me so far
Title: Re: Displaying 'news' as forum-wide 'super-sticky'
Post by: pongsak on April 26, 2007, 12:41:10 PM
Quote from: etdwh on July 05, 2006, 04:15:46 AM


//add rules
echo '
<div class="tborder" style="width: 100%;">
<table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">
<tr>
<td width="100%" colspan="7" class="catbg3">Global Announcements</td>
</tr>
' ;
foreach ($context['news_lines'] as $news)
{
echo '
<tr>
<td class="windowbg2" valign="middle" align="center" width="5%"><img src="', $settings['images_url'], '/topic/normal_post.gif" alt="" /></td>
<td class="windowbg2" valign="middle" align="center" width="4%"><img src="', $settings['images_url'], '/post/exclamation.gif" alt="" /></td>
<td class="windowbg3" valign="middle" colspan="5"><b>', $news, '</b></td>
</tr> ';
}
echo '

</table>
</div><br><br> ';
//end add rules


This shows ALL the news items as seperate topics.


but when no any news , it still show news announcement.
Then i add the code after // add rules
if ($context['news_lines']!==array('')){
and } before //end rules.

Then if no news , no show.
Title: Re: Displaying 'news' as forum-wide 'super-sticky'
Post by: popomovies on May 25, 2008, 02:41:24 PM
Does this work for 1.1.5?
Title: Re: Displaying 'news' as forum-wide 'super-sticky'
Post by: Bulakbol on May 25, 2008, 11:35:25 PM
There's a Global Announcement mod that work with 1.1.3. It might work with 1.1.5.
http://custom.simplemachines.org/mods/index.php?mod=419
Title: Re: Displaying 'news' as forum-wide 'super-sticky'
Post by: aldenddlove on June 11, 2008, 04:57:58 AM
that's right.
Title: Re: Displaying 'news' as forum-wide 'super-sticky'
Post by: nickysam on September 17, 2008, 05:06:11 AM
I'm new to this. I dont have any idea regarding this topic.
-----------------
Nickysam

FSBO (http://www.fastrealestate.net)
Title: Re: Displaying 'news' as forum-wide 'super-sticky'
Post by: SpectroPro on September 24, 2008, 03:58:56 PM
Any chance of this being made a mod for 2.x??  I wish super-sticky were just built in..  It's a GREAT idea and could be turned on or off...  Great for announcing a prize winner or special upcoming event.
Title: Re: Displaying 'news' as forum-wide 'super-sticky'
Post by: johnsimmons on October 04, 2008, 03:35:05 PM
Hi everyone...I am John from Mexico..I have seen your forum...Nice information provided here which is very useful to everyone....I am not a php programmer between, just done java and jsp's so far,so its not easy for me to figure this out in php.thanks for posting...Let me know more about this.....
==================================================================
simmons
Foreclosed Homes (http://auctions.fastrealestate.net)
Title: Re: Displaying 'news' as forum-wide 'super-sticky'
Post by: Nathaniel on November 05, 2008, 05:22:59 AM
@johnsimmons,
Do you need any help with this tip? You can always use the mod.

Also, there is a 'Scripting Help (http://www.simplemachines.org/community/index.php?board=8.0)' board where you can get help with/learn more about PHP. :)

@SpectroPro,
Hopefully it will be updated when SMF 2 has been around for longer. Remember that you could always ask the mod author about that in the support/comments topic for that mod (http://www.simplemachines.org/community/index.php?topic=106295.0).