View Single Post
Old 11-24-2008, 01:04 AM   #7 (permalink)
Wildhoney
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

I had a stab at a different approach for doing this without the ternary operator. See what you think to this, as it has support for many colours also.

Code:
<table>
<?php declare (ticks = 1): ?>
	<?php foreach ($aData as $iNumber): ?>
	
		<tr style="background-color: <?php echo $pRowColours->get(); ?>">
			<td>Row <?php echo $iNumber; ?></td>
		</tr>
		
	<?php endforeach; ?>
<?php enddeclare; ?>
</table>
Edit: Just a side note though, you don't have to use ticks for this. It could work without it.
Attached Files
File Type: rar Rows.rar (689 Bytes, 20 views)
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.

Last edited by Wildhoney : 11-24-2008 at 01:58 AM.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
The Following 2 Users Say Thank You to Wildhoney For This Useful Post:
codefreek (11-24-2008), Matt (11-24-2008)