I want to have every two articles on the homepage within a div structure.
However, I can't get this done in my node.tpl.php file: if I use the zebra variable to print a tag before the node when zebra is odd, and a closing tag after the node when zebra is even then this only works when there are an even number of articles, or otherwise the last div won't be closed.
<?php if($zebra=='odd'): ?> <div class='row'> <?php endif; ?> <div id="node-<?php print $node->nid; ?>" class="[..]"> [rest of node here] </div><!-- /#node-x --> <?php if($zebra == 'even'): ?> </div><!-- /.row --> <?php endif; ?>
To make this work, I must be able to know when a node is the last one. But there isn't a variable $last in the node template file, neither is there a $count variable that hold the total number of nodes.
Does anyone has done something similar before?