I am using phptemplate for my theme and flexinode for my content. I have a theme file node-flexinode-1.tpl.php which is being used to display my nodes. That all works fine.

My nodes consist of a body of text and an image. I have pages that are using php to select and display my flexinode nodes as a list of teasers. In my css classes I am floating the image so that it appears next to the body of text.

What I would like to be able to do is alternate the side that the images is floated to, so all the odd teasers are float: left and the even teasers are float: right.

I know that I just need a class tag to indicate which is which but I'm not sure how to flag each node as odd or even when it's being displayed.

I've tried searching for similar issues but come up empty so far. Any help would be most appreciated.

Comments

nevets’s picture

If you search for zebra stripes you will find a number of leads. I think the one at http://drupal.org/node/14629#comment-27501 will help your out (look at the second code block).

nasi’s picture

Fantastic, that's just what I was looking for and it works a a treat.

Thanks a lot.

For future reference, this technique is also in the handbook at http://drupal.org/node/16383