[SOLVED] How to alternate row colours in News module

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
rhysdavies
Forum Members
Forum Members
Posts: 31
Joined: Thu Oct 04, 2007 9:23 am

[SOLVED] How to alternate row colours in News module

Post 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!
Last edited by rhysdavies on Mon Jan 12, 2009 9:47 am, edited 1 time in total.
Ziggywigged
Power Poster
Power Poster
Posts: 424
Joined: Sat Feb 02, 2008 12:42 am
Location: USA

Re: How to alternate row colours in News module

Post by Ziggywigged »

I've used this javascript method in the past that worked well for me:
http://www.alistapart.com/articles/zebratables/
Take a penny, leave a penny.
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm
Location: Raalte, the Netherlands

Re: How to alternate row colours in News module

Post 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
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: How to alternate row colours in News module

Post by calguy1000 »

See the smarty {cycle} plugin.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
rhysdavies
Forum Members
Forum Members
Posts: 31
Joined: Thu Oct 04, 2007 9:23 am

Re: How to alternate row colours in News module

Post by rhysdavies »

Where's the {cycle } plugin?  I've looked all around and I must be very blind or very stupid!
rhysdavies
Forum Members
Forum Members
Posts: 31
Joined: Thu Oct 04, 2007 9:23 am

Re: How to alternate row colours in News module

Post 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!
Post Reply

Return to “Layout and Design (CSS & HTML)”