"._CATEGORIES.""; else $output .= "
".catlist($catid)."
"; $subs = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_categories WHERE parentcatid = '$catid' ORDER BY displayorder ASC"); $total = dbnumrows($subs); $list = floor($total / $displaycolumns); if($total % $displaycolumns != 0) $list++; $colwidth = (100/$displaycolumns) -1; $count = 0; $column = 1; $content = ""; if($total) { $collist = array(); $colcount = floor(($total / $displaycolumns) + ($total % $displaycolumns ? 1 : 0)); if(!$colcount) $colcount = 1; $mod = $total % $displaycolumns; $col = 0; $count = 0; while($cats = dbassoc($subs)) { unset($catinfo); $count++; if(file_exists("$skindir/categories.tpl")) $cat = new TemplatePower( "$skindir/categories.tpl" ); else $cat = new TemplatePower("default_tpls/categories.tpl"); $cat->prepare( ); $cat->newBlock("categoryblock"); $cat->assign("image", ($cats['image'] && file_exists("$skindir/images/".$cats['image']) ? "\"".$cats['category']."\"" : "")); $cat->assign("link", "".$cats['category'].""); $cat->assign("count", "[".$cats['numitems']."]"); $cat->assign("description", stripslashes($cats['description'])); if($displaycolumns == 1) $content .= "
".$cat->getOutputContent( )."
"; else $collist[$col][] = "
".$cat->getOutputContent( )."
"; if(($mod && $col < $mod && $count == $colcount) || ($mod && $col >= $mod && $count >= ($colcount - 1)) || (!$mod && $count == $colcount)) { $col++; $count = 0; } } if($displaycolumns > 1) { $output .= "
"; $col = 0; for($a = 0; $a < $colcount; $a++) { $output .= "
"; foreach($collist as $c) { if(isset($c[$a])) $output .= "
".$c[$a]."
"; } $output .= "
 
"; } $output .= "
 
"; } else { $output .= "
"; $output .= $content; $output .= "
"; } } if($catid > 0) { $storyquery .= _ORDERBY; $numrows = search(_STORYQUERY.$storyquery, _STORYCOUNT.$countquery, "browse.php?"); } $catid = array($catid); ?>