Page 1 of 1

[SOLVED] How to alternate row colours in News module

Posted: Fri Jan 09, 2009 2:53 pm
by rhysdavies
Hi all,

I would like my News Summary page to have alternating background colours for each summary, in the same way as the comments in the CMSMS Blog - http://blog.cmsmadesimple.org/2008/12/04/cms-made-simple-151-san-juan/

Any help would be gratefully appreciated!

Re: How to alternate row colours in News module

Posted: Fri Jan 09, 2009 2:57 pm
by Ziggywigged
I've used this javascript method in the past that worked well for me:
http://www.alistapart.com/articles/zebratables/

Re: How to alternate row colours in News module

Posted: Fri Jan 09, 2009 3:19 pm
by RonnyK
You can change the News-template to....


{foreach from=$items item=entry key=j}
  {if $j % 2 == 1}

{else}

{/if}
In the stylesheet you can then style....
.NewsSummary {
    margin:5px  0px;
}

.NewsSummary_odd {
    margin:5px  0px;
    background: #99B3E5;
}
Ronny

Re: How to alternate row colours in News module

Posted: Fri Jan 09, 2009 3:28 pm
by calguy1000
See the smarty {cycle} plugin.

Re: How to alternate row colours in News module

Posted: Fri Jan 09, 2009 4:09 pm
by rhysdavies
Where's the {cycle } plugin?  I've looked all around and I must be very blind or very stupid!

Re: How to alternate row colours in News module

Posted: Mon Jan 12, 2009 9:47 am
by rhysdavies
I've managed it!  Thank-you for your guidance especially with thte cycle plugin which I managed to find eventually, and to this thread http://forum.cmsmadesimple.org/index.php/topic,6159.0.html for tips on implementation!