[TESTING]
So you want to create alternating background colors for your (dynamically published) comments? I just came across a sweet little *gem in Hacking Movable Type about Smarty's "cycle" function... worth the price of the book, IMO. But, I digress. :-)
If you are using dynamic publishing for your individual entry archives, you can very simply edit your template to create alternating comment background colors (or any alternating style) with Smarty's "cycle" function.
The "cycle" funtion will, as the name implies, cycle through a list of values each time it is used within a loop. This is a perfect little solution for the task at hand. An added bonus is that it can cycle through more than two values, allowing you to alternate two, three or more styles. In MT's dynamic archives templates, the smarty cycle tag is written with double brackets {{cycle values="x,y,z"}}, using whatever values you want (numerals, words, etc). Here is one way to use it in your (MT3.2) individual entry archive template:
The template code outputs an alternating class around each comment, in this case: commentbg-x, commentbg-y, and commentbg-z. This is then easily styled with CSS.
The following sample style is a little overdone (read: ugly), but that is just to show the variety of ways in which the alternating styles can be tweaked beyond background and border colors.
FYI, you can also use Smarty's "cycle" function inside PHPSimplecomments, instead of that plugin's SimpleCommentOrder tag which is limited to only two values - "odd" and "even".
*I just ran into this same info online in a ProNet article that I know I read several times when it came out. I guess it never jumped out at me before... even so, Hacking MT is VERY MUCH worth owning - I highly recommend it. ;-)

Leave a comment