PDA

View Full Version : Alternating Rows Hack


11-04-2000, 11:26 PM
Someone asked me how to make alternating colored rows via ICQ and I lost them when I closed ICQ so here it is. This make the rows on the main page and on forumdisplay alternate color instead of alternating columns. 1.1.4
Make sure to remove the SPACES from the { firstaltcolor } and { secondaltcolor} and { timecolor} in the code below!!

Edit index.php:

find:

while ($category=$DB_site->fetch_array($categorys)) {

Add this before it:


$rowtoggle = 1;


find:

eval("\$tempforumbits .= \"".gettemplate("forumbit")."\";");

Add this BEFORE it:


if ($rowtoggle == 1)
{
$rowcolor = "{ firstaltcolor }";
$rowtoggle = 0;
}
else
{
$rowcolor = "{ secondaltcolor }";
$rowtoggle = 1;
}



Edit forumdisplay.php

find:

while ($thread=$DB_site->fetch_array($threads)) {

Add this before it:


$rowtoggle = 1;


find:

eval("\$forumdisplaybits .= \"".gettemplate("$usetemplatebit")."\";");

Add this BEFORE it;


if ($rowtoggle == 1)
{
$rowcolor = "{ firstaltcolor }";
$rowtoggle = 0;
}
else
{
$rowcolor = "{ secondaltcolor }";
$rowtoggle = 1;
}


Replace your forumbit template with this:


<TR bgcolor="$rowcolor">
<TD align=center valign=top><IMG SRC="images/$onoff.gif" BORDER=0></td>
<TD valign=top><normalfont><B>
<A HREF="forumdisplay.php?forumid=$forumid">$forumtitle</A></B></normalfont><BR>
<smallfont>$forumdescription</smallfont></td>
<td align=center valign=top NOWRAP>
<normalfont>$numberposts</normalfont></td>
<td align=center valign=top NOWRAP>
<normalfont>$numberthreads</normalfont></td>
<td NOWRAP valign=top align=center>
<normalfont><a href="showthread.php?goto=lastpost&forumid=$forumid"><img src="images/lastpost.gif" border=0 alt="Go to last post"></a> $lastpostdate <normalfont COLOR="{ timecolor }">$lastposttime</normalfont>
<br><smallfont>$lastposter</smallfont></td>
<td valign=top align=center>
<normalfont>$moderators</normalfont></td>
</tr>


Replace your forumdisplaybit template with this:


<TR bgcolor="$rowcolor">
<TD align=center>
<IMG SRC="images/$newoldhot.gif" BORDER=0></td>

<td align=center>
$threadicon
</td>

<td width="100%"><normalfont>
$gotonew <A HREF="showthread.php?threadid=$threadid">$threadtitle</a> <smallfont>$pagenav</smallfont></normalfont>
</td>

<td align=center nowrap>
<normalfont>$firstposter</normalfont>
</td>

<td align=center>
<normalfont>$replies</normalfont>
</td>

<td align=center>
<normalfont>$views</normalfont>
</td>

<td nowrap>
<normalfont><a href="showthread.php?goto=lastpost&threadid=$threadid"><img src="images/lastpost.gif" border=0 alt="Go to last post"></a> $lastreplydate <normalfont COLOR="{ timecolor }">$lastreplytime</normalfont> by $lastposter</normalfont>
</td></tr>


[Edited by freddie on 11-04-2000 at 10:26 PM]

11-05-2000, 02:21 AM
Thanks so much Freddie you relly helped me. Just one note that when you change the info in the templates make sure that you put in the proper link, i.e. instead of
<A HREF="forumdisplay.php? etc.>, I had to enter <A HREF=forumdispllay.php3? etc.>.
In any case, Freddie I thank you so much. YOU'RE THE BEST!

11-05-2000, 03:16 PM
Thanks. All you need to do is remove the bgcolor from each <td> and place bgcolor="$rowcolor" in the <tr> or replace the templates with mine.