You are here:  » changes in atoz.php

Support Forum



changes in atoz.php

Submitted by nosferatu on Mon, 2011-01-03 15:12 in

Hi,
is there any solution to change atoz.php to make it to look something like this:

A
------------------------------------------
ab ah am
ac ai an
ad aj ao
af ak ap
ag al aq

B
------------------------------------------
bb bh bm
bc bi bn
bd bj bo
bf bk bp
bg bl bq

----
and so on...

Thank U

Submitted by support on Tue, 2011-01-04 10:02

Hi,

Sure - here is an alternative html/atoz.php with a layout as described above...

<div class='atoz'>
<?php
  $columns = 3;
  $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 "<hr />";
      $currentLetter = $firstLetter;
      print "<table width='100%'>";
      print "<tr>";
    }
    print "<td valign='top' width='".$columnWidth."%'>";
    print "<p><a href='".$item["href"]."'>".$item["name"]."</a></p>";
    print "</td>";
    $currentColumn++;
    if ($currentColumn == $columns)
    {
      print "</tr>";
      print "<tr>";
      $currentColumn = 0;
    }
  }
  if ($currentColumn) print "</tr>";
  print "</table>";
?>
</div>

Cheers,
David.
--
PriceTapestry.com

Submitted by nosferatu on Thu, 2011-01-06 21:02

thank u thank u thank u ...