Im trying to create a function that will generate a catalog. I have this code that will create a table with three columns. It does work and displays everything fine. The problem comes when there are photos on the catalog that varying height, then the catalog looks disorganized. You can check an example of the function working at:
www.tallercreativo.us/framework/STORE/catalog.php
I would like to have all the text aligned vertically regardless of the image size. I was thinking about throwing a <tr> tag everytime there are images but im having trouble figuring it out. Please let me know if you have any suggestions.
$count = 0;
while($row = mysql_fetch_array($result))
{
if(($count-(3*floor($count/3)))==0)
{
$table .= '<tr>';
}
$count++;
$startlink = '<a href="'.$_SERVER['PHP_SELF'].'?id='.$row['id'].'&show=1">';
$table.='<td>';
foreach($array as $key => $value)
{
if($key=='image')
{
$trimmed = trim($row[$value]);
if($trimmed!='')
{
$table.=$startlink.'<img src="'.$imagefolder.$row[$value].'" />'.$endlink.'<br />';
}
}
elseif($key=='title')
{
$trimmed = trim($row[$value]);
if($trimmed!='')
{
$table.='<strong>'.$startlink.$row[$value].$endlink.'</strong><br />';
}
}
elseif($key=='price')
{
$trimmed = trim($row[$value]);
if($trimmed!='')
{
$table.='<span style="color:#F03;font-weight:bold;">$'.$row[$value].'</span><br />';
}
}
else
{
$trimmed = trim($row[$value]);
if($trimmed!='')
{
$table.=$row[$value].'<br />';
}
}
}
$table.='</td>';
if(($count-(3*floor($count/3)))==0)
{
$table .= '</tr>';
}
}
mysql_free_result($result);