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
- , the second [1] and so on).
To display a selected news item as 'forum rules' within every message index:
Search sometheme/MessageIndex.template.php for:
if (!empty($options['show_board_desc']) && $context['description'] != '')
And add the same new code before (retaining or changing the array key as appropriate to retain or change the news item from the previous example).
Note that these hacks are not mutually dependent and will still work if you disable news from your Current Theme's Settings (so obviating the need to hack any more templates to remove the normal news display), but you'll need to limit the news display to one item instead of a random selection if you also want to use it as originally intended for 'news'. So search sometheme/index.template.php for:
$context['random_news_line']
And replace it with:
$context['news_lines'][0]
Where $context['news_lines'][0] again selects the news item specified by the array key, which I'd normally expect to be different from that chosen for either of the two previous examples. So I'd suggest something like this:
$context['news_lines'][0] (first news item) for normal news.
$context['news_lines'][1] (second news item) for board level rules.
$context['news_lines'][2] (third news item) for topic level rules.
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
I was thinking about something like a "Global Sticky" that shows in all boards :P
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.
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.
Sorry for digging up this old topic but what is this trick suppose to do ?
Are the codes in the first post still applicable in 1.1RC2?
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:
- column for topic icon and post icon is slightly bigger than actual post below it, would be nice if i can make it the same. Not sure why the size is different though
- shows all news items, would be lovely if i can choose which item to display for different boards. Im not a php programmer btw, just done java and jsp's so far, so its not easy for me to figure this out in php :D
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. ;)
Any update on this one for 1.1 RC2?
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 ;)
It's not a mod yet though, is it.?
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
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.
Does this work for 1.1.5?
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
that's right.
I'm new to this. I dont have any idea regarding this topic.
-----------------
Nickysam
FSBO (http://www.fastrealestate.net)
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.
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)
@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).