RE: Table formation...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux