m13b.net

Journal

Zebra Tables

Very nice. I took the idea from here and found a way to do it within the PHP I was already using.

All I had to do was create an incrementing variable in my pre-existing while loop, and make a function that checks the remainder when it’s divided by two to see if it’s even or odd. If it’s even, it gives the table row the class=’even’, if odd, class=’odd’. (This way, it’s independent of the movie’s id number, and therefore doesn’t screw up when you sort the rows.) Add a little CSS, and voilà.

Yes, I am retarded enough to be impressed by that. Thanks for noticing.

Check it out in action.

Comments are closed.

This journal is powered by WordPress and created, designed and managed by LaTour Creations.
Entries (RSS) and Comments (RSS)