Alternate Table Rows in CakePHP (and ZF, Rails, Smarty)
In my last posting I talked about alternating table row colors with plain PHP. But how is this handled in different frameworks like CakePHP, Zend Framework, Rails or Smarty?
[UPDATE: My CakePHP-Cycle-Helper is described here: http://functino.com/2009/07/cakephp-cycle-helper-alternating-row-colors-with-cake/]
I’m going to show you simple examples for each of this tools.
In Smarty you can alternate table row colors (or any [...]
Zebra Tables: How to alternate table row colors
What is a “Zebra Table”? It’s a striped table with alternating row colors like this:
You can achieve this with very different approaches:
CSS only
With CSS 3 you can achieve such a table with the pseudo class nth-child. The rules are extremly simple and no additonal markup is required. Just add these lines to your CSS:
tr:nth-child(even) {background-color: [...]
Subscribe