[Help] Alternating Row Color in Custom Theme
                    I'm working on a custom theme+style right now, and I've run into a brick wall with alternating background colors on the Discussion list. 
It would be neat if I could somehow add a another class to the #Discussion_# tag, that alternates between rownumber_0 or rownumber_1. I've tried doing this in the theme page, but it won't let me do anything other than echo the number.
Any ideas or help? I know next to nothing of the Vanilla theme backend. I guess I could always take the easy route out and style #Discussion_2 different than #Discussion_3 and so on.
                It would be neat if I could somehow add a another class to the #Discussion_# tag, that alternates between rownumber_0 or rownumber_1. I've tried doing this in the theme page, but it won't let me do anything other than echo the number.
Any ideas or help? I know next to nothing of the Vanilla theme backend. I guess I could always take the easy route out and style #Discussion_2 different than #Discussion_3 and so on.
0          
            This discussion has been closed.
             
         
            
Comments
In the beginning of the file, right after:
$LastUrl = GetLastCommentQuerystring($Discussion, $this->Context->Configuration, $CurrentUserJumpToLastCommentPref);add:
if (!isset($row_count)) { static $row_count = 1; }Next, right after:
<li id="Discussion_'.$Discussion->DiscussionID.'" class="Discussion'.add (you can customize Odd/Even to be whatever classnames you want):
($row_count & 1 ? ' Odd' : ' Even').Finally, at the end of the file, after:
</li>';add:
$row_count++;(Edit: updated to correct code.)
Try this, it should act correctly now:
Instead of:
static $row_count = 1;use:
if (!isset($row_count)) { static $row_count = 1; }I think I misunderstood this discussion is this for alternating coments or only for discussions ;-)
I used it on my in-progress style, if you want to see it in action.
how would we adapt this to alternating comments ?
<li id="Comment_38367"> ... <li id="Comment_38368" class="Alternate"> ... <li id="Comment_38369"> ... <li id="Comment_38370" class="Alternate"> ...If you check my green-theme you can see how I use it on the comment section