国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > CMS > PhpCMS > 正文

phpcms v9怎么調用網站最新文章

2024-09-10 07:14:55
字體:
來源:轉載
供稿:網友

調用欄目下最新文章,很簡單,action="postion"改為"lists",一定要加上catid(欄目id),代碼如下:

  1. {pc:content action="lists" catid="72" num="8" order="id DESC"
  2. <UL class=rt> 
  3. {loop $data $r} 
  4.   <li><a href="{$r[url]}" target="_blank">{str_cut($r[title],36,'')}</a></li> 
  5. {/loop} 
  6. </UL> 
  7. {/pc} 

Phpcms v9默認不支持調用全站最新文章,需要修改文件:/phpcms/modules/content/classes/content_tag.class.php,找到以下函數:

  1. public function lists($data) { 
  2. $catid = intval($data['catid']); 
  3. if(!$this->set_modelid($catid)) return false; 
  4. if(isset($data['where'])) { 
  5. $sql = $data['where']; 
  6. else { 
  7. $thumb = intval($data['thumb']) ? " AND thumb != ''" : ''
  8. if($this->category[$catid]['child']) { 
  9. $catids_str = $this->category[$catid]['arrchildid']; 
  10. $pos = strpos($catids_str,',')+1; 
  11. $catids_str = substr($catids_str$pos); 
  12. $sql = "status=99 AND catid IN ($catids_str)".$thumb
  13. else { 
  14. $sql = "status=99 AND catid='$catid'".$thumb
  15. $order = $data['order']; 
  16. $return = $this->db->select($sql'*'$data['limit'], $order'''id'); 
  17. //調用副表的數據 
  18. if (isset($data['moreinfo']) && intval($data['moreinfo']) == 1) { 
  19. $ids = array(); 
  20. foreach ($return as $v) { 
  21. if (isset($v['id']) && !emptyempty($v['id'])) { 
  22. $ids[] = $v['id']; 
  23. else { 
  24. continue
  25. if (!emptyempty($ids)) { 
  26. $this->db->table_name = $this->db->table_name.'_data'
  27. $ids = implode('/',/''$ids); 
  28. $r = $this->db->select("`id` IN ('$ids')"'*''''''''id'); 
  29. if (!emptyempty($r)) {  //Vevb.com 
  30. foreach ($r as $k=>$v) { 
  31. if (isset($return[$k])) $return[$k] = array_merge($v$return[$k]); 
  32. return $return

修改為:

  1. public function lists($data) { 
  2. $catid = intval($data['catid']); 
  3. if(isset($data['where'])) { 
  4. $sql = $data['where']; 
  5. else { 
  6. $thumb = intval($data['thumb']) ? " AND thumb != ''" : ''
  7. if(!emptyempty($catid)) { 
  8. if(!$this->set_modelid($catid)) return false; 
  9. if($this->category[$catid]['child']) { 
  10. $catids_str = $this->category[$catid]['arrchildid']; 
  11. $pos = strpos($catids_str,',')+1; 
  12. $catids_str = substr($catids_str$pos); 
  13. $sql = "status=99 AND catid IN ($catids_str)".$thumb
  14. else { 
  15. $sql = "status=99 AND catid='$catid'".$thumb
  16. else { 
  17. $sql = "status=99".$thumb
  18. $order = $data['order']; 
  19. $return = $this->db->select($sql'*'$data['limit'], $order'''id'); 
  20. //調用副表的數據 
  21. if (isset($data['moreinfo']) && intval($data['moreinfo']) == 1) { 
  22. $ids = array(); 
  23. foreach ($return as $v) { 
  24. if (isset($v['id']) && !emptyempty($v['id'])) { 
  25. $ids[] = $v['id']; 
  26. else { 
  27. continue
  28. if (!emptyempty($ids)) { 
  29. $this->db->table_name = $this->db->table_name.'_data'
  30. $ids = implode('/',/''$ids); 
  31. $r = $this->db->select("`id` IN ('$ids')"'*''''''''id'); 
  32. if (!emptyempty($r)) { 
  33. foreach ($r as $k=>$v) { 
  34. if (isset($return[$k])) $return[$k] = array_merge($v$return[$k]); 
  35. return $return

調用方法:{pc:content action="lists" num="10" order="id DESC" cache="3600"}

pc標簽值:

action="lists"--------------內容數據(文章)列表

order="id DESC"---------------------排序類型="id DESC"

num="10" ----------------------數據調用數量="10"

cache="3600"-------------------緩存="3600"毫秒

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 巴马| 手游| 新乡市| 民丰县| 石门县| 乌兰浩特市| 介休市| 滨州市| 凯里市| 尚义县| 上犹县| 津市市| 丹巴县| 阳朔县| 山东| 清徐县| 曲周县| 孟津县| 兴和县| 田阳县| 图们市| 嘉义县| 盖州市| 封开县| 奇台县| 三门峡市| 泊头市| 永吉县| 开鲁县| 浑源县| 察雅县| 丰宁| 寻乌县| 饶阳县| 左贡县| 河西区| 上犹县| 富锦市| 曲松县| 娄底市| 斗六市|