Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Thema gestartet von: m3talc0re in Juli 13, 2008, 11:15:38 NACHMITTAGS

Titel: Hiding random news if no news is available.
Beitrag von: m3talc0re in Juli 13, 2008, 11:15:38 NACHMITTAGS
Right now, if you have no news available for the random news box in the header, you'll see the space for it and the News: text without any news showing. To turn that off, you have to go to another settings area and disable the random news item altogether. A quick and easy fix for this is to simply hide it if no news is available.

Open the index.template.php and find this:

// Show a random news item? (or you could pick one from news_lines...)
if (!empty($settings['enable_news']))
echo '
<td width="90%" class="titlebg2">
<span class="smalltext"><b>', $txt[102], '</b>: ', $context['random_news_line'], '</span>
</td>';


See the if statement? This is what you want (notice the if again):

// Show a random news item? (or you could pick one from news_lines...)
if ((!empty($settings['enable_news'])) && (!empty($context['random_news_line'])))
echo '
<td width="90%" class="titlebg2">
<span class="smalltext"><b>', $txt[102], '</b>: ', $context['random_news_line'], '</span>
</td>';
Titel: Re: Hiding random news if no news is available.
Beitrag von: metallica48423 in Juli 21, 2008, 03:00:06 VORMITTAG
Hey thanks for the tip!

I had actually been looking for something like this for awhile.  Thanks!