News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

WebReference.com:
How To Create Alternating Row Colors in PHP
June 20, 2007 @ 11:12:00

WebReference.com has a simple new tutorial today showing how to create alternating table rows in the output for your application.

Almost every database driven Web site uses alternating row colors when displaying a list of records, a concept used all over the Internet. You've seen it used, you like it, and now you want to do it yourself. But you're not sure how to accomplish it. Well you've come to the right place. I'm going to discuss the basic idea behind achieving this and give some concrete examples demonstrating different ways to implement it.

Their script loops through the information (numbers in their case) and checks, using the modulus operator to check and see which of the CSS styles it should apply to the div. To give a range of possibility, they also show how to do it with a while loop instead of a for to do a little benchmarking of the methods.

1 comment voice your opinion now!
alternate row color table forloop whileloop css alternate row color table forloop whileloop css


blog comments powered by Disqus

Similar Posts

The Bakery: Some ideas to organize your CSS files and autoload them in CakePHP

DevShed: Working with CSS Styles and the Stage Pattern in PHP 5

Rob Allen's Blog: One-to-Many Joins with Zend_Db_Table_Select

ArtyPapers.com: P+C DTR - PHP & CSS Dynamic Text Replacement

DevShed: User-defined Interfaces in PHP 5 - Turning MySQL Classes into Interface Implementers


Community Events

Don't see your event here?
Let us know!


introduction series voicesoftheelephpant library laravel5 psr7 opinion extension language interview framework podcast community conference development laravel video api unittest release

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework