$sql = $vbulletin->db->query_read("SELECT * FROM `" . TABLE_PREFIX . "download_cats` WHERE cat_active = '1'");$total = $vbulletin->db->num_rows($sql);$i=0;$perrow = $total-2;while ($row = $db->fetch_array($sql)){ $cid = $row['catid']; $cat = $row['catitle']; $description = $row['cat_description']; $caticon = $row['cat_icon']; $i++; if ($total !== 0) { if ($total > $perrow){ $catc = '</td>'; $perrow = $perrow+2; } else { $perrow = $perrow-2; $catc = '</td></tr><tr>'; } $cat_data = vB_Template::create('bfc_download_cat_bit'); $cat_data->register('cid', $cid); $cat_data->register('cat', $cat); $cat_data->register('description', $description); $cat_data->register('caticon', $caticon); $cat_data->register('catc', $catc); $cat_data->register('cat_bit', $cat_bit); $cat_bit .= $cat_data->render(); }}