I have a script that displays categories and sub categories if a checkbox is selected during category addition.
The problem I'm having is getting them to display properly. Here is the code I use now to get 2 columns of categories only, sub cats I can't get to work and not sure how I would get to work.
PHP Code:
$number_cats = 0;
$cats = $vbulletin->db->query("SELECT * FROM `" . TABLE_PREFIX . "xsdl_cats` WHERE sub_cat = '0'");
while($category = $vbulletin->db->fetch_array($cats))
{
$cid = $category['cid'];
$cname = $category['cat_name'];
// $rating = round($entry['rating']);
$description = $category['description'];
$subcat = $category['sub_cat'];
$file_loc = $category['file_loc'];
$screen_loc = $category['screen_loc'];
$query = $db->query_first("
SELECT COUNT(`dlid`) AS `total`
FROM `" . TABLE_PREFIX . "xs_downloads`
WHERE cat_id = " . $category['cid'] . "
");
$count = $query['total'];
$show['open_row'] = $number_cats++ %2 == 0;
eval('$downloads_bit .= "' . fetch_template('xs_downloads_bit') . '";');
}
Any help much appreciated.
Steve M