destroy(); } //$template_content = & new PMDTemplate(PMDROOT .'/template/' . $config['template'] . '/index.tpl','index.tpl'.$_SERVER['REQUEST_URI']); $template_content = & new PMDTemplate(PMDROOT .'/template/' . $config['template'] . '/index.tpl'); $template_content->set('yes',$homepage); $template_content->set('lang',$lang); $template_content->set('mod_rewrite',$config['mod_rewrite']); $template_content->set('search_display_all',$config['search_display_all']); /****** CHECK FOR A SPECIFIC CATEGORY BEING SET ************/ if (!isset($_GET['id']) AND $_GET['id'] == '') { $path = array(); $show_banner=$config['show_banner_index']; $_GET['id'] = 1; } else { if($config['mod_rewrite'] == 'YES') { $categories = explode('/',$_GET['id']); $category_part = array(); foreach($categories as $key=>$value) { if(sizeof($category_part) > 0) { $lft_rgt_sql = "AND left_>".$category_part['left_']." AND right_<".$category_part['right_']; } $category_part = $db->GetRow("SELECT id, left_, right_ FROM ".T_CATEGORY." WHERE friendly_url=? $lft_rgt_sql AND level=?",array($value,$key+1)); } //$path = $category_tree->getPathByFriendlyURL($categories[(count($categories)-1)]); $_GET['id'] = $category_part['id']; } $path = $category_tree->getPath($_GET['id']); $path_count = count($path); if($path_count < 1) { header('HTTP/1.1 410 Gone'); header('Location: '.BASE_URL); exit(); } $category_tree->addHit($_GET['id'],$_SERVER['REMOTE_ADDR']); if(!($template_content->is_cached())) { $show_banner = $config['show_banner_cats']; //$path = $category_tree->getPath($_GET['id']); //$category_url_string = getPlainTextString($path,'/',true); $page_title = getCategoryPathDisplay($path,$lang['category'],'|',true,'status_line'); $incomingline = ''.$lang['home'].' | '.$page_title; $cat_info = $path[($path_count-1)]; if($cat_info['description'] != '' AND $config['show_category_description'] == 'YES') { $cat_info['description'] = unHTML($cat_info['description'].'


'); } else { $cat_info['description'] = ''; } if($config['show_category_title'] != 'YES') { $cat_info['title'] == ''; } $template_content->set('cat_info',$cat_info); } } if(!($template_content->is_cached())) { if($config['show_indexes'] == 'NO' AND $config['cat_empty_hidden'] == 'NO') { $get_category_count = false; } else { $get_category_count = true; } if ($config['show_subs_number'] > 0) { $categories=$category_tree->getCategoryPlusImmediateChildren($_GET['id'], 2, $get_category_count); } else { $categories=$category_tree->getCategoryPlusImmediateChildren($_GET['id'], 1, $get_category_count); } $first_level_count = 0; $first_level_count_reference = $categories[0]['level']; for ($i=0;$i 0 OR $config['cat_empty_hidden'] != 'YES')) { $first_level_count++; } // If we never get the listing counts for categories, make it 1 for all categories so they all display normally. Then if clicked we give a no listings message. (speed improvement) if(!$get_category_count) { $categories[$i]['count'] = 1; } } $j = 0; $category_table = ''; if($config['category_vertical_sort'] == "YES") { $category_table .= ''; } $td_width = floor(100 / $config['category_num_columns']); for ($i=0;$i'; } if($config['category_vertical_sort'] != 'YES') { $maincat_string .= ''; } elseif($j % ceil($first_level_count/$config['category_num_columns']) == 0 AND $config['category_vertical_sort'] == 'YES') { $maincat_string .= ''; } $category_table .= $maincat_string; } if ($j % $config['category_num_columns'] != 0 AND $config['category_vertical_sort'] != 'YES') { while ($j % $config['category_num_columns'] != 0) { $category_table .= ''; $j++; } $category_table .= ''; } else { //echo ''; } $category_table .= '
'; } $subcat_string = ''; $maincat_string .= ''; $j++; if ($j % $config['category_num_columns'] == 0 AND $config['category_vertical_sort'] != 'YES') { $maincat_string .= '
 
'; /****************************************** * Show Listings if any exist in category ******************************************/ $listing_page = declare_page($_GET['page']); $page_start = get_page_start($listing_page,$config['count_directory']); $fetchcounter = $config['count_directory']; $r = $category_tree->getListings($_GET['id'],false, $page_start, $config['count_directory'],'membership DESC, firmname'); $results_amount = $category_tree->getListings($_GET['id'],true); $results_amount = $results_amount->FetchRow(); ob_start(); if($results_amount['count'] > 0) { echo '
   '.$lang['results'].': '.$results_amount['count'].'

'; if ($results_amount['count'] > 0) { include (PMDROOT . "/includes/template_listing_results.php"); if ( $config['count_directory'] > 0 ) { if ($config['mod_rewrite'] == 'YES') { echo paginate($results_amount['count'], $config['count_directory'], 30, $listing_page, $lang['previous'], $lang['next'], $lang['first'], $lang['last'], getCategoryURL($cat_info['id'],$cat_info['friendly_url'],$lang['category'],$path).'#page.html', true); } else{ echo paginate($results_amount['count'], $config['count_directory'], 30, $listing_page, $lang['previous'], $lang['next'], $lang['first'], $lang['last'], getCategoryURL($cat_info['id'],$cat_info['friendly_url'],$lang['category'],$path).'&page=#page', true); } } echo '

'; } echo '

'; } elseif(sizeof($categories) < 1 AND $_GET['id'] != 1) { echo ''.$lang['no_listings'].''; } $listing_results = ob_get_contents(); ob_end_clean(); if($config['search_display_all'] != 'YES') { include (PMDROOT.'/includes/template_searchform.php'); $template_content->set('searchform',$searchform); } $template_content->set('category_table',$category_table); $template_content->set('listing_results',$listing_results); $template_search_alpha_links = & new PMDTemplate(PMDROOT .'/template/' . $config['template'] . '/blocks/search_alpha_links.tpl'); $template_search_alpha_links->set('alpha_letters',explode('#',$config['alpha_index_search'])); $template_content->set('search_alpha_links',$template_search_alpha_links); $meta_desc = $cat_info['title'].' '.$cat_info['description']; } include(PMDROOT.'/includes/template_setup.php'); ?>