By BilldaCat on
I'd like to alternate between two div tags in my node.tpl.php file so I can shade every other content item. The problem is, any counter I set in there, global or not, ends up getting reset for each iteration.
My code in node.tpl.php, for example:
if (is_odd($page_style_counter)) {
} else {
<? } $page_style_counter++; ?>
(if_odd is defined elsewhere)
any ideas?
Comments
Quick n dirty
Get your scoping right.
.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/
.dan. is the New Zealand Drupal Developer working on Government Web Standards
i know
In the original post, I mentioned 'global or not', it didn't work. I tried setting it in node.tpl.php, as well as page.tpl.php, with no success.
Odd. You sure?
This worked exactly as expected for me:
node.tpl.phpDrupal 5. PHP5.1.2. (zen theme)
.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/
.dan. is the New Zealand Drupal Developer working on Government Web Standards
thanks
don't know what i was doing wrong with the global declaration. appreciate the help.
The snippet worked for me.
The snippet worked for me. Thanks.