You are here:  » A to Z

Support Forum



A to Z

Submitted by babrees on Sat, 2010-04-10 11:56 in

At the moment I have 4 columns, the first row is the A to Z with the products on the second row, etc.

Is it possible to have the layout as follows?

A

product product product product
product product product product
product product product product
product product product

B

product product product product
product product product product
product product product product
product product product

Submitted by support on Sat, 2010-04-10 12:15

Hi Jill,

Have a go with this version of html/atoz.php for that style of layout:

<div class='atoz'>
<?php
  $columns = 4;
  $columnWidth = intval(100/$columns);
  $currentLetter = "";
  $currentColumn = 0;
  foreach($atoz["items"] as $item)
  {
    $firstLetter = strtoupper(substr($item["name"],0,1));
    if ($firstLetter !== $currentLetter)
    {
      if ($currentLetter !== "")
      {
        print "</tr>";
        print "</table>";
      }
      print "<h4>".$firstLetter."</h4>";
      print "<table width='100%'>";
      print "<tr>";
      $currentLetter = $firstLetter;
    }
    $currentColumn++;
    print "<td valign='top' width='".$columnWidth."%'>";
    print "<a href='".$item["href"]."'>".$item["name"]."</a>";
    print "</td>";
    if ($currentColumn == $columns)
    {
      print "</tr>";
      print "<tr>";
      $currentColumn = 0;
    }
  }
  print "</tr>";
  print "</table>";
?>
</div>

Cheers,
David.

Submitted by babrees on Sat, 2010-04-10 14:51

Thanks David - Perfect as usual!

---------
Jill