Alternate colors in messageindex.template

Started by dannbass, December 08, 2007, 01:40:50 PM

Previous topic - Next topic

dannbass

Hi!
I successfully alternated colors in the boardindex and the childboards in the messageindex, but still no luck with the topics.
I tried the http://www.simplemachines.org/community/index.php?topic=112131.msg718948#msg718948 method and this one http://www.simplemachines.org/community/index.php?topic=48717.msg346799#msg346799 that is the same but applied.

Could please someone help me out with this? or if anyone knows of a theme that has that so I could take a lot a the line it will really help a lot!

Thanks!

Kays

What I did on one theme was this:

$cnt = 1;
        foreach ($context['topics'] as $topic)
        {
$cnt++;
if ($cnt >= 2) $cnt = 0;
               echo '
                                <tr class="windowbg', $cnt == 0 ? '' : '2', '" >

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

dannbass


Kays

Cool, It's not pretty but it does get the job done. :)

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Alpha_Vector

Quote from: Kays on December 08, 2007, 04:29:50 PM
Cool, It's not pretty but it does get the job done. :)
You could use the modulo operator to save the conditional, something along this lines:


$cnt++;
               echo '
                                <tr class="windowbg',  ($cnt % 2) == 1 ?  '' : '2', '" >


Also you can make it not be every two boards, maybe every three or four.

dannbass


Advertisement: