Jump to content

How can I make the categories display in list style instead of left to right.


Cynical

Recommended Posts

I have this piece of code but I'm unsure of how to make it sort in list style instead of left to right.. 
 
Example 1, How it is now: 
 
Category1 - SubCategory1 | Category1 - SubCategory2 | Row 3 | Row 4 | Row 5 |
 
Category1 - SubCategory3 | Category2 - SubCategory1 | Row 3 | Row 4 | Row 5
 
Example 2, What I need it to do:
 
Category1 - SubCategory1 | Category2  - SubCategory2    
 
Category1 - SubCategory2 
 
Category2  - SubCategory1 
 
Column 4
 
Column 5
 

If anybody could guide me to some examples/tutorials or has any pointers it would be much appreciated.

 

I tried looking at some SQL examples but all they showed me is what I've already done.

<table align="center">
<tr align='right'>
<?php
$i = 0;
$cats = SQL_Query_exec("SELECT * FROM categories ORDER BY parent_cat, name");
while ($cat = mysql_fetch_assoc($cats)) {
    $catsperrow = 5;
    print(($i && $i % $catsperrow == 0) ? "</tr><tr align='right'>" : "");
    print("<td style=\"padding-bottom: 2px;padding-left: 2px\"><a href='categories.php?cat={$cat["id"]}'>".htmlspecialchars($cat["parent_cat"])." - " . htmlspecialchars($cat["name"]) . "</a> <input name='c{$cat["id"]}' type=\"checkbox\" " . (in_array($cat["id"], $wherecatina) || $_GET["cat"] == $cat["id"] ? "checked='checked' " : "") . "value='1' /></td>\n");
    $i++;
}

Thanks in advance for any help. 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.