• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

PHP Assistance?

Jator

Golden Member
I am finishing up converting the RC5 PHP stats to OGR PHP stats. I am stuck on one thing. I am trying to get the table to have alternating colors, similar to the tables on DNet, using colors #ffffdd & #dddddd. I set a variable of $backcolor and put in a if/else statement telling it to alternate through each pass, but for some reason all I could get it do do was change on the first pass, the rest wouldn't change, they would stay the same as the first pass.

Here is a link to the code of the page Code and here is a link to the page itself Stat Page.

Basically, here is what I had added:
$backcolor=ffffdd

if ($backcolor=ffffdd) {
$backcolor=dddddd;
} else {
$backcolor=ffffdd;
}

I tried putting this in various places in the while statement, again with no luck past the first pass of the table building. Any advice on what I am doing wrong would be greatly appreciated.

Jay
 
Try something like this (I use this on the mattzone site - you'll have to initial $rtemp at the beginning of your program):

if ($rtemp == 0 ) {
echo &quot;<tr bgcolor=E7F3F7><td>$rcount</td><td>$rank</td><td><a
href=team_detail.php3?temp_team=$temp_team>$club_name</a></td><td>$units</td><td>$chg_units</td><td>$chg_rank</td><td>$num_membe
rs</td><td>$chg_members</td></tr>&quot;;
$rtemp = 1;
} else {
echo &quot;<tr bgcolor=eeeeee><td>$rcount</td><td>$rank</td><td><a
href=team_detail.php3?temp_team=$temp_team>$club_name</a></td><td>$units</td><td>$chg_units</td><td>$chg_rank</td><td>$num_membe
rs</td><td>$chg_members</td></tr>&quot;;
$rtemp = 0;


 
nexus,

many thanks. Got it to work with that piece of code. One thing to note, unless I had the ($ctemp==0); (double '=') it wouldn't work. Might of been my oringinal problem.

Jay

***EDIT*** Yup, that was it. By simply not having the second '=' in the if statement, that was causing it not to alternate. Thanks again Nexus.
 
Back
Top