You are here:  » Print in colums

Support Forum



Print in colums

Submitted by henk on Tue, 2007-01-16 22:14 in

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)."&amp;brandFilter=".urlencode($row["brand"]);
      print "<a href='".$fabrikantHREF."'>".$row["brand"]."</a> |";
    }
  }
}
?>

Cheers HEnk

Submitted by support on Tue, 2007-01-16 22:18

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)."&amp;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.

Submitted by henk on Wed, 2007-01-17 19:53

Great ! Thx HEnk

link