function show_categories() { global $sph_messages; if (Configure::read('show_categories') != 0) { if (empty($this->search)) { if ($_REQUEST['catid'] && is_numeric($catid)) { $cat_info = Category::get_category_info($catid); } else { $cat_info = Category::get_categories_view(); } } else { if ($catid && is_numeric($catid)) { echo "<div id='results'>\n\t\t\t\t\t\t<p class='mainlist'>" . $sph_messages['Back'] . ":\n\t\t\t\t\t\t\t<a href='" . WEBROOT_DIR . "/?setcss1={$thestyle}' title='" . $sph_messages['tipBackCat'] . "'>" . $sph_messages['Categories'] . "</a>\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<div class='odrow'>\n\t\t\t\t\t\t\t<p class='title'>\n\t\t\t\t\t"; $acats = ""; $i = 0; foreach ($cat_info['cat_tree'] as $_val) { $i++; $acats .= "<a href='" . WEBROOT_DIR . "/?catid=" . $_val['category_id'] . "&setcss1={$thestyle}' title='" . $sph_messages['tipSelCat'] . "'>" . $_val['category'] . "</a> » "; if ($i > 5) { $i = 0; $acats = substr($acats, 0, strlen($acats) - 9) . "<br /> » "; } } $acats = substr($acats, 0, strlen($acats) - 9); echo "{$acats}</p></div>\n\t\t\t\t\t"; if ($cat_info['subcats']) { echo "<p class='mainlist'>" . $sph_messages['SubCats'] . "</p>\n\t\t\t\t\t\t\t<div class='odrow'><p class='title'>\n\t\t\t\t\t\t"; $bcats = ""; foreach ($cat_info['subcats'] as $_key => $_val) { $bcats .= "<a href='" . WEBROOT_DIR . "/?catid=" . $_val['category_id'] . "&setcss1={$thestyle}' title='" . $sph_messages['tipSelBCat'] . "'>" . $_val['category'] . "</a> (" . $_val['count'][0][0] . ") » "; } $bcats = substr($bcats, 0, strlen($bcats) - 9); echo "{$bcats}</p></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t"; } else { echo "</div>\n\t\t\t\t\t\t"; } // get name of current category $result = mysql_query("select category from " . TABLE_PREFIX . "categories where category_id = '{$catid}'"); if (DEBUG > '0') { echo mysql_error(); } $catname = mysql_result($result, 0); if (!$cat_info['cat_sites']) { // if no site is attached to this cat echo "\r\n<p class='mainlist'><a href='" . WEBROOT_DIR . "' title='" . $sph_messages['tipBackCat'] . "'>" . $sph_messages['noSites'] . " {$catname}</a></p>\r\n"; } else { // list of web pages in current category echo "<p class='mainlist'>" . $sph_messages['Web pages'] . $catname . "</p>\n\t\t\t\t\t\t"; foreach ($cat_info['cat_sites'] as $_key => $_val) { if ($_key & 1) { echo "<div class='odrow'>\n\t\t\t\t\t\t\t\t"; } else { echo "<div class='evrow'>\n\t\t\t\t\t\t\t\t"; } $count = $_key + 1; echo "<p class='title'>"; if (Configure::read('show_search_results_count')) { echo "<span class='em sml'>" . $count . ".</span>"; } echo "\n\t\t\t\t\t\t\t\t\t\t<a href='" . $_val['url'] . "'>" . $_val['title'] . "</a>\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t<p class='description'>" . $_val['short_desc'] . "</p>\n\t\t\t\t\t\t\t\t\t<p class='url'>" . $_val['url'] . "</p>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t"; } echo "</div></div>\n\t\t\t\t\t\t"; } } else { if ($cat_info['main_list']) { echo "<div id='results'>\n\t\t\t\t\t\t\t<div class='headline cntr'><em>" . $sph_messages['Categories'] . "</em></div>\n\t\t\t\t\t\t"; foreach ($cat_info['main_list'] as $_key => $_val) { if ($_key & 1) { echo '<div class="odrow">' . "\r\n"; } else { echo '<div class="evrow">' . "\r\n"; } echo "<p class='title'>\n\t\t\t\t\t\t\t\t<a class='em' href='" . WEBROOT_DIR . "/?catid=" . $_val['category_id'] . "&setcss1={$thestyle}' title='" . $sph_messages['tipSelCat'] . "'>" . $_val['category'] . "</a><br />\n\t\t\t\t\t\t\t"; if (is_array($_val['sub'])) { $ccats = ""; foreach ($_val['sub'] as $__key => $__val) { $ccats .= "<a href='" . WEBROOT_DIR . "/?catid=" . $__val['category_id'] . "&setcss1={$thestyle}' title='" . $sph_messages['tipSelBCat'] . "'>" . $__val['category'] . "</a> » "; } echo $ccats; } echo '</p>' . "\r\n" . '</div>' . "\r\n"; } echo '</div>' . "\r\n"; } } } } }