troubleshooting Question

Displaying out put from a database in php in directory style.

Avatar of awdman
awdman asked on
3 Comments1 Solution196 ViewsLast Modified:
I have a directory which currently outputs the categories in columns like this

a    b   c
d    e   f
g    h   i

I want the output to be this

a   d   g
b   e   h
c   f    i
like google directory

this is the function that does the database output

<table width="100%" cellpadding="4" cellspacing="0" border="0" class="dmozCats">

$count = 1;
if (isset($dmoz)) {
      foreach ($dmoz as $cat){
            if ($count==1) echo "<tr>";
            $iii = $cat['root']['id'];
      <td valign="top" align="left" width="33%">
      <? //) ?>
      <div class="mainCatListing"><a href="<?  echo $cache->call('sefRelToAbs','index.php?option=com_directory&page=viewcat&catid='.$cat['root']['id'].'&Itemid='.$PXT_CONFIG['itemid_main']); ?>"><?=$cat['root']['name'] . CountInCat($cat['root']['id']); ?></a></div>



      if (count(@$cat['subcats'])) {
            foreach ($cat['subcats'] as $id=>$cat){
                  $string[] = "<a href=\"".sefRelToAbs('index.php?option=com_directory&page=viewcat&catid='.$id.'&Itemid='.$PXT_CONFIG['itemid_main'])."\">$cat" . CountInCat($id) ."</a>";
            $link = sefRelToAbs('index.php?option=com_directory&page=viewcat&catid='.$iii.'&Itemid='.$PXT_CONFIG['itemid_main']);
            $str = $PXT_CONFIG['txt_more'] ? "<a href=\"$link\">".$PXT_CONFIG['txt_more']."</a>" : "";

            echo implode (", ", $string).$str;

      echo "</td>";
      if ($count==3){
            echo "</tr>";
      } else {
} else {
      echo "No categories defined";
if ($count==2) echo "<td width=\"33%\"> </td> <td width=\"33%\"> </td>";
if ($count==3) echo "<td width=\"33%\"> </td>";
echo "</tr>";

Can anyone advise how i can change the way it displays the data please??

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros