I have been doing something something similar in my views.

<?php foreach ($items as $key => $row): ?>
<tr<?php if ( $key%2 ) { echo ' class="altRow"'; }?>>
    <td nowrap><?php echo $row['Model']['field'] ?></td>
</tr>
<?php endforeach?>

I have the altRow class defined in my style sheet.


On 8/19/06, c_doug <[EMAIL PROTECTED]> wrote:

Can anyone tell me how to alternate row colors in CakePHP? Is it
similar to doing it in regular PHP?

Ex:
$row_color = ($row_count % 2) ? $color1 : $color2;

$row_count++;



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to