[ Index ] |
|
Code source de CMS made simple 1.0.5 |
1 <?php 2 3 if (!isset($gCms)) exit; 4 5 $depth = 1; 6 7 $query = ' 8 SELECT news_category_id, news_category_name, hierarchy, long_name 9 FROM ' .cms_db_prefix(). 'module_news_categories 10 WHERE hierarchy not like \'\' 11 '; 12 if (isset($params['category']) && $params['category'] != '') 13 { 14 $categories = explode(',', $params['category']); 15 $query .= ' AND ('; 16 $count = 0; 17 foreach ($categories as $onecat) 18 { 19 if ($count > 0) 20 { 21 $query .= ' OR '; 22 } 23 if (strpos($onecat, '|') !== FALSE || strpos($onecat, '*') !== FALSE) 24 $query .= "upper(long_name) like upper('". trim(str_replace('*', '%', $onecat)) . "')"; 25 else 26 $query .= "news_category_name = '" . trim($onecat). "'"; 27 $count++; 28 } 29 $query .= ') '; 30 } 31 $query .= ' ORDER by hierarchy'; 32 $dbresult = $db->Execute($query); 33 34 $rowcounter=0; 35 while ($dbresult && $row = $dbresult->FetchRow()) 36 { 37 $q2 = "SELECT COUNT(news_id) as cnt FROM ".cms_db_prefix()."module_news WHERE news_category_id=?"; 38 $dbres2 = $db->Execute($q2,array($row['news_category_id'])); 39 $count = $dbres2->FetchRow(); 40 $row['index']=$rowcounter++; 41 $row['count']= $count['cnt']; 42 $row['prevdepth'] = $depth; 43 $depth= count(split('\.', $row['hierarchy'])); 44 $row['depth']=$depth; 45 $row['url'] = $this->CreateLink($id,'default',$params['detailpage']!= ''?$params['detailpage']:$returnid,$row['news_category_name'],array('category'=>$row['news_category_name'],'browsecat'=>'-1'),'',true); 46 $items[] = $row; 47 } 48 #Display template 49 $this->smarty->assign('count', count($items)); 50 $this->smarty->assign('cats', $items); 51 echo $this->ProcessTemplate('browsecat.tpl'); 52 53 54 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Tue Apr 3 18:50:37 2007 | par Balluche grâce à PHPXref 0.7 |