I think you'll be better off using the {cycle} tag. I'm (still) no Smarty expert, but here's my modification for the sidebar.tpl in templates/default/:
Code: Select all
<div class="serendipitySideBarItem container_{$item.class} {cycle values="graybox, redbox"}">
The {cycle} tag will insert the next value each time it's called, then go back to the first. This allows it to work with alternations by threes, for instance.
Similarly, for comments.tpl (again from templates/default/), you could change the <div> after the first {foreach} thusly:
Code: Select all
<div class="serendipity_comment serendipity_comment_author_{$comment.author|@makeFilename} {if $entry.author == $comment.author}serendipity_comment_author_self{/if} {cycle values="graybox, redbox"}" style="padding-left: {$comment.depth*20}px">