desc("site_text",$lang_set,'previous'),'cat'); SmartyPaginate::setPrevText($language->desc("site_text",$lang_set,'previous'),'list'); SmartyPaginate::setNextText($language->desc("site_text",$lang_set,'next'),'cat'); SmartyPaginate::setNextText($language->desc("site_text",$lang_set,'next'),'list'); SmartyPaginate::setFirstText($language->desc("site_text",$lang_set,'first'),'cat'); SmartyPaginate::setFirstText($language->desc("site_text",$lang_set,'first'),'list'); SmartyPaginate::setLastText($language->desc("site_text",$lang_set,'last'),'cat'); SmartyPaginate::setLastText($language->desc("site_text",$lang_set,'last'),'list'); $xlimit = SmartyPaginate::getCurrentIndex('cat'); $ylimit = SmartyPaginate::getLimit('cat'); $xalimit = SmartyPaginate::getCurrentIndex('list'); $yalimit = SmartyPaginate::getLimit('list'); // Category List if ($_GET['cat']){ $r = mysql_query ("SELECT SQL_CALC_FOUND_ROWS * FROM $pds_category WHERE p='$_GET[cat]' ORDER BY title LIMIT $xlimit,$ylimit;") or die("Error getting sub categories: ".mysql_error()); SmartyPaginate::setURL("index.php?cat=$_GET[cat]",'cat'); }else{ $r = mysql_query ("SELECT SQL_CALC_FOUND_ROWS * FROM $pds_category WHERE p IS NULL ORDER BY title LIMIT $xlimit,$ylimit;") or die("Error getting main categories: ".mysql_error()); } $r1 = mysql_query("SELECT FOUND_ROWS() as total;"); $f1 = mysql_fetch_assoc($r1); $r_rows = mysql_num_rows($r); for ($x=0;$x<$r_rows;$x++){ $f = mysql_fetch_array($r); $categories[$x]['id'] = $f['id']; $categories[$x]['title'] = $language->desc('category',$lang_set,$f['id']); if ($f[f_mt] != "" OR !$config['disable_empty_cat']){ if($config['rewrite']){ $mod_id = $categories[$x]['id']; $mod_title = str_replace(' ','_',getCatPath($f['id'])); $mod_title = str_replace('/','-',$mod_title); $categories[$x]['href'] = "".$categories[$x]['title'].""; }else{ $categories[$x]['href'] = "".$categories[$x]['title'].""; } }else{ $categories[$x]['href'] = $categories[$x]['title']; } } $tpl-> assign('categories',$categories); SmartyPaginate::setTotal($f1['total'],'cat'); SmartyPaginate::assign($tpl,'paginate_cat','cat'); //*********************************************** // Button Press Logic //*********************************************** if ($_GET['cat']){ //*********************************************** // Process Categories and Listings //*********************************************** // Get the selected category information $r_cat = mysql_query ("SELECT * FROM $pds_category WHERE id='$_GET[cat]';") or die(mysql_error()); // and read into associated array $f_cat $f_cat = mysql_fetch_assoc ($r_cat); // Assign $cat_title $cat_title = $language->desc('category', $lang_sel, $f_cat['id']); $tpl-> assign('cat_title',$cat_title); if($config['rewrite']){ $mod_cat_title = str_replace(' ','_',getCatPath($_GET['cat'])); $mod_cat_title = str_replace('/','-',$mod_cat_title); $tpl-> assign('mod_cat_title',$mod_cat_title); } // Check for category content header $file_check = "templates/$config[deftpl]/t_inc/$f_cat[id]_contenthead.tpl"; // If there is category content header information if (file_exists($file_check)){ // Assign $cat_head_file $tpl-> assign('cat_head_file',"$config[deftpl]/t_inc/$f_cat[id]_contenthead.tpl"); // Assign $cat_head $tpl-> assign('cat_head',$language->desc('cat_content', $lang_set, 'cat'.$f_cat[id].'h')); }else{ // No category content header information found $tpl-> assign('cat_head_file',""); } // Check for category content footer $file_check = "templates/$config[deftpl]/t_inc/$f_cat[id]_contentfoot.tpl"; // If there is category content footer information if (file_exists($file_check)){ // Assign $cat_foot_file $tpl-> assign('cat_foot_file',"$config[deftpl]/t_inc/$f_cat[id]_contentfoot.tpl"); // Assign $cat_foot $tpl-> assign('cat_foot',$language->desc('cat_content', $lang_set, 'cat'.$f_cat[id].'f')); }else{ // No category content footer information found $tpl-> assign('cat_foot_file',""); } //*********************************************** // Title Tag //*********************************************** $title_tag = $language->desc('site_text',$lang_set,'main_title'); $title_tag .= " | ".$cat_title; $mod_title = str_replace(' ','_',getCatPath($f_cat[id])); $mod_title = str_replace('/','-',$mod_title); //*********************************************** // Breadcrumb Link //*********************************************** $title[] = $language->desc("category",$lang_set,$f_cat[id]); $cid[] = $f_cat[id]; $parent = $f_cat[p]; while ($parent == true){ $rbc = mysql_query ("SELECT * FROM $pds_category WHERE id='$parent';"); $fbc = mysql_fetch_assoc($rbc); $title[] = $language->desc("category",$lang_set,$fbc[id]); $cid[] = $fbc[id]; $parent = $fbc[p]; $catid = $fbc[id]; mysql_free_result($rbc); } $title = array_reverse($title); $cid = array_reverse($cid); for ($x=0;$x< count($title);$x++){ $bread_crumb[$x] = $title[$x]; if ($x == count($title) - 1){ // Disabled Button $btn_link[$x] = "disabled"; }else{ // Linked Button if($config['rewrite']){ $mod_title = str_replace(' ','_',$title[$x]); $mod_title = str_replace('/','-',$mod_title); $btn_link[$x] = "onClick=\"document.location.href='./$mod_title-".$cid[$x]."-0.html'\""; }else{ $btn_link[$x] = "onClick=\"document.location.href='./index.php?cat=".$cid[$x]."'\""; } } } $tpl-> assign('show_page','index_sub'); //*********************************************** // Listings //*********************************************** $r_list = mysql_query ("SELECT SQL_CALC_FOUND_ROWS * FROM $pds_listcat lc INNER JOIN $pds_list l ON lc.list_id=l.id WHERE cat_id='$_GET[cat]' AND state='apr' ORDER BY l.premium DESC, l.firm LIMIT $xalimit,$yalimit;"); SmartyPaginate::setURL("index.php?cat=$_GET[cat]",'list'); $r2 = mysql_query("SELECT FOUND_ROWS() as total;"); $f2 = mysql_fetch_assoc($r2); for ($x=0;$xdesc('site_text',$lang_set,'main_title'); $_GET['cat'] = 0; $mod_title = str_replace(' ','_',$title_tag); $mod_title = str_replace('/','-',$mod_title); //*********************************************** // Breadcrumb Link //*********************************************** //*********************************************** // Language Select List //*********************************************** $tpl-> assign('lang_select_box', $language->select('code_lang', $lang_set, array('value'=>$lang_set,'options' => 'onchange="submit()"'))); //*********************************************** // Template Select List //*********************************************** $tpl-> assign('template_select_box', $language->select('template', $lang_set, array('value'=>$config['deftpl'],'options' => 'onchange="submit()"'))); $tpl-> assign('show_page','index_subs'); } //*********************************************** // Assign local variables to template //*********************************************** $tpl-> assign('title_tag',$title_tag); $tpl-> assign('bread_crumb',$bread_crumb); $tpl-> assign('btn_link',$btn_link); $tpl-> assign('main_title',$language->desc('site_text',$lang_set,'main_title')); $tpl-> assign('list',$list); $tpl-> assign('cat_id',$_GET['cat']); $tpl-> assign('mod_title',$mod_title); // Show Template $tpl-> display("$config[deftpl]/index.tpl"); ?>