Hi
How can i make this code nice in colums:
<?php
if ($parts[0] == "category")
{
print "Filter by category: ";
$sql = "SELECT DISTINCT brand FROM `".$config_databaseTablePrefix."products` WHERE category = '".database_safe($parts[1])."'"."ORDER BY brand";;
if (database_querySelect($sql,$rows))
{
foreach($rows as $row)
{
$fabrikantHREF = $config_baseHREF."search.php?q=".urlencode($q)."&brandFilter=".urlencode($row["brand"]);
print "<a href='".$fabrikantHREF."'>".$row["brand"]."</a> |";
}
}
}
?>
Cheers HEnk
Hi Henk,
You could try the techniques similar to that used to display the featured products in rows:
http://www.pricetapestry.com/node/284
Here's a quick go at something that might work in your code. For more columns just increase the number "3" in the code...
<?php
if ($parts[0] == "category")
{
print "Filter by category: ";
$sql = "SELECT DISTINCT brand FROM `".$config_databaseTablePrefix."products` WHERE category = '".database_safe($parts[1])."'"."ORDER BY brand";;
if (database_querySelect($sql,$rows))
{
print "<table>";
print "<tr>";
$count = 0;
foreach($rows as $row)
{
$fabrikantHREF = $config_baseHREF."search.php?q=".urlencode($q)."&brandFilter=".urlencode($row["brand"]);
print "<td><a href='".$fabrikantHREF."'>".$row["brand"]."</a></td>";
if ($count++ == 3)
{
print "</tr><tr>";
$count = 0;
}
}
print "</tr>";
print "<table>";
}
}
?>
Hope this helps!
David.