Display two different rows of items

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
jackgittes
Forum Members
Forum Members
Posts: 23
Joined: Mon Sep 28, 2009 9:04 pm

Display two different rows of items

Post by jackgittes »

Looked in the forums but could not find an answer. I am using the cataloger and I want to display a page with items. But I want the first row to have a white background and the second row a different color. The third row has to be white again and and fourth the same color as the second and so on.

I know how to do the css styling but how can I manage this in the code? I have to define two rows in the Cataloger templates I guess but how can I tell Cataloger these are seperate items?

Hope someone has an idea.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Display two different rows of items

Post by Dr.CSS »

Depends on how you are making the rows, one way is to give them a class and use css to style the class the way you want...
jackgittes
Forum Members
Forum Members
Posts: 23
Joined: Mon Sep 28, 2009 9:04 pm

Re: Display two different rows of items

Post by jackgittes »

I don't see how I could solve this with only css.

This is what Cataloger has to generate:

Code: Select all

   <ul id="subgroepen">
             <li class="white"><a href="#">Group 1</a></li>
             <li class="blue"><a href="#">Group 2</a></li>
             <li class="white"><a href="#">Group 3</a></li>
             <li class="blue"><a href="#">Group 4</a>
</li>
   </ul
And this is what is now in my cataloger template:

Code: Select all

  <ul id="subgroepen">
        
    {section name=numloop loop=$items}
        <li class="white"><a href="{$items[numloop].link}">{$items[numloop].title}</a></li>
        <li class="white"><a href="{$items[numloop].link}">{$items[numloop].title}</a></li>
   {/section}
   </ul>   
This code goes wrong because it generates every group double. The idea is that it fills the first with group 1 and the second with group 2 (just like in the first code block). But now it fills both with the same group.

Any idea?
Last edited by jackgittes on Sat Jan 23, 2010 9:11 pm, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Display two different rows of items

Post by Dr.CSS »

Then you need to use some code to cycle thru them, something like this...

{capture assign="capturer"}
{cycle values="even,odd" name="capturername"}
{/capture}

Then in your for each something like this, with only one call for the li not 2 as it is now...

Post Reply

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