Table Highlighting

5 posts by 4 authors in: Forums > CMS Builder
Last Post: May 18, 2010   (RSS)

By (Deleted User) - May 17, 2010

I am setting up a table system but can not remember how to get the table to highlight every second line.

For example:

Date Time
24 2pm <-- white background
28 1pm <-- grey background
30 12pm <-- white background
31 5pm <-- grey background

Something like that.

Re: [hegadmin] Table Highlighting

By Jason - May 17, 2010

Hi,

Are you currently outputting a table without highlighting?
If you could post the code you have so far (or attach your .php file) I can help you do this.

Thanks.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Table Highlighting

By (Deleted User) - May 18, 2010 - edited: May 18, 2010

Yes I am using tables with out highlighting.

I have not created the page but I know how to do a listing of the section. I was not going to create the page until i figured out how to do the table highlighting.

Re: [hegadmin] Table Highlighting

By rconring - May 18, 2010

Here is a simplified example ... set alternate colors at top of foreach loop, then echo the color on each row.
Hope this helps.

<table>
<?php foreach ($whateverRecords as $record): ?>
<?php $bgColor = (@$bgColor == '#F0F0F0') ? '#FFFFFF' : '#F0F0F0'; ?>
<tr bgcolor="<?php echo $bgColor ?>"> <td>
<?php echo $record['name'] ?>
</td>
<td>
<a href="mailto:<?php echo $record['email'] ?>">Send Email</a>
</td>
</tr>
<?php endforeach ?>
</table>
Ron Conring
Conring Automation Services
----------------------------------------
Software for Business and Industry Since 1987