Forums

Alternate Table Row BG Color

decbuck 10 Dec, 2008
Is there a way to alternate the colour of the table background displayed for data from a table. here is my body


=======<table>
<tr>
<th COL WIDTH='80px'>Date (YYYY-MM-DD)</th>
<th COL WIDTH='80px'>Time</th>
<th COL WIDTH='80px'>Age</th>
<th COL WIDTH='80px'>Sport</th>
<th COL WIDTH='80px'>Team</th>
<th COL WIDTH='80px'>Score</th>
<th COL WIDTH='80px'>Team</th>
<th COL WIDTH='80px'>Score</th>
{new_record}
</tr>
=========

and finally my body
---------------------------------
<tr>
<td>{matchdate}{edit_record}</td>
<td>{matchtime}{edit_record}</td>
<td>{age_group}{edit_record}</td>
<td>{sport}{edit_record}</td>
<td>Maynooth{edit_record}</td>
<td>{maynooth_score}{edit_record}</td>
<td>{opponent}{edit_record}</td>
<td>{opponent_score}{edit_record}</td>
</tr>
-------------------


I usuallu set a variable and use a counter to determine every second row. Can't see that option here.
Cheers
GreyHead 10 Dec, 2008
Hi decbuck,

Groping in the dark a bit here, there is a variable $counter that seems to count the rows. You could try and see if you could use a little php to create a binary value from it and add that to a class name.

Bob
Max_admin 10 Dec, 2008
you don't need to add the {edit_record} to every table cell too, only 1 cell per table row!

Regards
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
decbuck 11 Dec, 2008
Yeah I noticed that with the edit. Thanks,

Any examples of the php script
Max_admin 12 Dec, 2008
Hi, try this in the body:

<?php
$k = 0;
$k = 1 - $k;
?>


Regards
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
This topic is locked and no more replies can be posted.