News Summary layout

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
fadum

News Summary layout

Post by fadum »

Does anyone know how i could edit the news summary template to show the news in boxes 2 wide

example

instead of

news 1
news 2
news 3
news 4

it would be
news 1news 2news 3news 4

the layout would be similar to http://news.bbc.co.uk

many thanks inadvance
fadum

Re: News Summary layout

Post by fadum »

anyone?
nils73
Power Poster
Power Poster
Posts: 520
Joined: Wed Sep 08, 2004 3:32 pm

Re: News Summary layout

Post by nils73 »

You can do this with Smarty in the News > Template section:

Code: Select all

<table border="0" cellpadding="0" cellspacing="0" width="100%">
  {foreach from=$items item=entry name=newslist}
    {if $smarty.foreach.newslist.iteration % 2 == 1}
    <tr>
      <td>
        <h4 id="news{$entry->id}">{$entry->title}</h4>
        <p>{$entry->data}</p>
        <p>Date: {$entry->date}</p>
      </td>
    {else}
      <td>
        <h4 id="news{$entry->id}">{$entry->title}</h4>
        <p>{$entry->data}</p>
        <p>Date: {$entry->date}</p>
      </td>
    </tr>
    {if ! $smarty.foreach.imagelist.last}
    <tr>
      <td colspan="2">From here on joined cols in table-layouts!</td>
    </tr>
    {/if}
    {/if}
  {/foreach}
</table>
fadum

Re: News Summary layout

Post by fadum »

nils73 thank you very much, it works perfect :)
nils73
Power Poster
Power Poster
Posts: 520
Joined: Wed Sep 08, 2004 3:32 pm

Re: News Summary layout

Post by nils73 »

Actually it was just a guess, but you can do nice things with Smarty ... like change the colors of multiple rows in a table (grey, white, grey, ...) and many many more. I simply love these features because I don't know anything about programming but need some functions for templating purpose and Smarty comes up with really nice solutions that can be easily implemented. Check out the manual at http://smarty.php.net - it comes multilingual!

Regards,
Nils
fadum

Re: News Summary layout

Post by fadum »

excellent thanks will have a read
Locked

Return to “CMSMS Core”