Advertisement:

Author Topic: Displaying 'news' as forum-wide 'super-sticky'  (Read 37235 times)

Offline Peter Duggan

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,663
  • Gender: Male
    • Peat Stack or Pete's Tack?
Displaying 'news' as forum-wide 'super-sticky'
« 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) 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:

Code: [Select]
// Is this topic also a poll?
And add before:

Code: [Select]
// 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 [0], 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:

Code: [Select]
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:

Code: [Select]
$context['random_news_line']
And replace it with:

Code: [Select]
$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.
« Last Edit: November 03, 2004, 02:04:15 PM by Peter Duggan »

Offline FaSan

  • Sophist Member
  • *****
  • Posts: 1,053
  • Gender: Male
  • http://www.smitaly.net
    • SMitaly - Supporto a SMF
Re: Displaying 'news' as forum-wide 'super-sticky'
« Reply #1 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

Offline Jerry

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,903
  • Gender: Male
  • What? I can't hear you over my awesomeness!!
    • PlanetSMF
Re: Displaying 'news' as forum-wide 'super-sticky'
« Reply #2 on: December 30, 2004, 04:59:44 PM »
I was thinking about something like a "Global Sticky" that shows in all boards :P
- Jerry
Find me on:
Facebook
Twitter
PlanetSMF

"If all you look for is the negative in things, you will never see the positive."

Offline Amacythe

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,060
  • Gender: Female
Re: Displaying 'news' as forum-wide 'super-sticky'
« Reply #3 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.

Offline Peter Duggan

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 4,663
  • Gender: Male
    • Peat Stack or Pete's Tack?
Re: Displaying 'news' as forum-wide 'super-sticky'
« Reply #4 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.

Offline Vinspire

  • Sr. Member
  • ****
  • Posts: 852
  • Gender: Male
    • The Box Of Heart Forum
Re: Displaying 'news' as forum-wide 'super-sticky'
« Reply #5 on: May 10, 2006, 04:28:22 AM »
Sorry for digging up this old topic but what is this trick suppose to do ?

Offline geezmo

  • Full Member
  • ***
  • Posts: 439
Re: Displaying 'news' as forum-wide 'super-sticky'
« Reply #6 on: June 21, 2006, 11:59:07 AM »
Are the codes in the first post still applicable in 1.1RC2?

Offline etdwh

  • Semi-Newbie
  • *
  • Posts: 36
  • Gender: Male
Re: Displaying 'news' as forum-wide 'super-sticky'
« Reply #7 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:
Code: [Select]
if (!empty($options['show_board_desc']) && $context['description'] != '')
add the following above it:
Code: [Select]
//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.  ;)

Offline PrizeLive.com

  • Full Member
  • ***
  • Posts: 683
    • PrizeLive.com
Re: Displaying 'news' as forum-wide 'super-sticky'
« Reply #8 on: July 13, 2006, 09:16:13 AM »
Any update on this one for 1.1 RC2?
Get Paid Instantly via PayPal (or other options) at PrizeLive.com!

Offline etdwh

  • Semi-Newbie
  • *
  • Posts: 36
  • Gender: Male
Re: Displaying 'news' as forum-wide 'super-sticky'
« Reply #9 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

The download is on page 3, but read the other posts, just so you know what you are getting into  ;)

Offline PrizeLive.com

  • Full Member
  • ***
  • Posts: 683
    • PrizeLive.com
Re: Displaying 'news' as forum-wide 'super-sticky'
« Reply #10 on: July 19, 2006, 08:36:13 AM »
It's not a mod yet though, is it.?
Get Paid Instantly via PayPal (or other options) at PrizeLive.com!

Offline etdwh

  • Semi-Newbie
  • *
  • Posts: 36
  • Gender: Male
Re: Displaying 'news' as forum-wide 'super-sticky'
« Reply #11 on: July 24, 2006, 03:27:36 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

Offline pongsak

  • Jr. Member
  • **
  • Posts: 181
  • Gender: Male
Re: Displaying 'news' as forum-wide 'super-sticky'
« Reply #12 on: April 26, 2007, 12:41:10 PM »

Code: [Select]
//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
Code: [Select]
if ($context['news_lines']!==array('')){and
Code: [Select]
} before //end rules.

Then if no news , no show.
smf 1.1.2 with dilbermc themes.
> 50 mods installed.

Offline popomovies

  • Semi-Newbie
  • *
  • Posts: 28
Re: Displaying 'news' as forum-wide 'super-sticky'
« Reply #13 on: May 25, 2008, 02:41:24 PM »
Does this work for 1.1.5?

Offline Bulakbol

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 5,220
  • Gender: Male
  • JohnyB
Re: Displaying 'news' as forum-wide 'super-sticky'
« Reply #14 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
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

Offline aldenddlove

  • Newbie
  • *
  • Posts: 7
    • Check Your Site's Coming Alexa Rank
Re: Displaying 'news' as forum-wide 'super-sticky'
« Reply #15 on: June 11, 2008, 04:57:58 AM »
that's right.

Offline nickysam

  • Newbie
  • *
  • Posts: 1
Re: Displaying 'news' as forum-wide 'super-sticky'
« Reply #16 on: September 17, 2008, 05:06:11 AM »
I'm new to this. I dont have any idea regarding this topic.
-----------------
Nickysam

hxxp:www.fastrealestate.net [nonactive]

Offline SpectroPro

  • Jr. Member
  • **
  • Posts: 376
  • Gender: Male
    • The Reality Rocks Group
Re: Displaying 'news' as forum-wide 'super-sticky'
« Reply #17 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.
Stats:  SMF v. 2b4  -  Mambo v4.65  -  Bridge v2.0b1

http://www.therealityrocks.com    http://forum.therealityrocks.com/trr
- Greg

Offline johnsimmons

  • Newbie
  • *
  • Posts: 1
Re: Displaying 'news' as forum-wide 'super-sticky'
« Reply #18 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
hxxp:auctions.fastrealestate.net [nonactive]

Offline Nathaniel

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,117
  • Gender: Male
    • Verbtest.com
Re: Displaying 'news' as forum-wide 'super-sticky'
« Reply #19 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' 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.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.