RE: [PHP] Table formation...

From: Date: Mon, 17 Apr 2006 12:57:00 +0000
Subject: RE: [PHP] Table formation...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-234111@lists.php.net to get a copy of this message
Jay said:
With a simple loop I can create the data in columns in a table. It is a table of products, each product's features, etc. I am not too worried about the client changing the layout at a later date as that would likely be driven by me...maybe. :) The code which makes the multiple columns of data is right simple and could easily be replaced. if(0 == $columnCount){ echo "<tr>"; } ...do table stuff... if(0 == $columnCount){ $columnCount++; // increment to 1 else { echo "</tr>\n"; $columnCount--; // decrement to 0 } The following is just another way (not using mod):
<?php echo("<table><tr>"); for ($i = 0; $i <= 9; $i++) { echo("<td>$i</td>"); if($i & 1) { echo("<tr></tr>"); } } echo("</tr><table>"); ?> Whenever I need a 1 or 0, I use ($i & 1).
So, semantics freaks ;), the entire site is a CSS thing of beauty with a LAMP back-end, and there is only one spot where I have used a small table that I need to get rid of. This product table is justified as a table.
Yep, nothing wrong with using tables to show column data -- that's what tables are for. tedd -- -------------------------------------------------------------------------------- http://sperling.com

« previous php.general (#234111) next »