Page 1 of 1

Display two different rows of items

Posted: Sat Jan 23, 2010 8:19 am
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.

Re: Display two different rows of items

Posted: Sat Jan 23, 2010 8:05 pm
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...

Re: Display two different rows of items

Posted: Sat Jan 23, 2010 9:10 pm
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?

Re: Display two different rows of items

Posted: Sat Jan 23, 2010 11:58 pm
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...