SSI News Side PHP Block

in Tutorials on 07 Mar 2013



If you hate the News section on the header as much as i do, here's a simple solution. Display your latest news on a side PHP block. Like the default news, it will reload different news upon browser reload.

Create a PHP block, add this code. Customize it to your needs and activate.

The CSS. Add this to the index.css of your theme.

.iblock {
    font-size: 16px;
    background-color: #f9f9f9;
    border-left: 8px solid #eb6c6c;
    color: #444;
    line-height: 1.4em;
    padding: 2.8em 1.6em;
    margin: 0.1em 0 0.3em 0;
    overflow: auto;
}


The markup. Add this to the PHP block.

echo '

  <div class="iblock">';
      ssi_news();

echo '
  </div>';


Remove the News bit from the Index.template.php so it does not show twice. Should look like this in most idesign360 themes.

<div class="news">';

// Show a random news item? (or you could pick one from news_lines...)
if (!empty($settings['enable_news']))
echo '
<p>', $context['random_news_line'], '</p>';

echo '
</div>


Demo: On our blog page.  :wink:




idesignSMF Team
Mick is an American theme designer for Simple Machines Forum software currently living in South Florida, USA. He runs idesignSMF.com and started tinkering with SMF in 2006 where he created several SMF forums of his own before he founded idesignSMF in 2009 to which he is dedicated full time.

idesignSMF.com | SimpleMachines.org



0 Comments


rocket_launch

Brand spankin' new free SMF themes every month.