Table Highlighting

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

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 Kenny - May 18, 2010

You'll need to adapt to your fields, but try this:

<h3>Contact Us</h3>
<table>
<tr>
<th>title</th>
<th>name</th>
<th>phone</th>
<th>email</th>
</tr>
<?php foreach ($contact_listRecords as $record): ?>
<?php $bgColor = (@$bgColor == '#F8F8F8') ? '#EFEFEF' : '#F8F8F8'; ?>
<tr bgcolor="<?php echo $bgColor ?>">
<td><?php echo $record['title'] ?></td>
<td><?php echo $record['name'] ?></td>
<td><?php echo $record['phone'] ?></td>
<td><a href="mailto:<?php echo $record['email'] ?>"><?php echo $record['email'] ?></a></td>
</tr>
<?php endforeach; ?>
</table>



Kenny

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