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

首頁 > CMS > PhpCMS > 正文

Phpcms V9 調(diào)用全站最新文章的代碼

2024-09-10 07:18:15
字體:
供稿:網(wǎng)友

Phpcms默認(rèn)不支持調(diào)用全站最新文章,需要修改文件:/phpcms/modules/content/classes/content_tag.class.php,找到以下函數(shù):

  1. /** 
  2.       * 列表頁標(biāo)簽 
  3.       * @param $data 
  4.       */ 
  5.      public function lists($data) { 
  6.          $catid = intval($data['catid']); 
  7.          if(!$this->set_modelid($catid)) return false; 
  8.          if(isset($data['where'])) { 
  9.              $sql = $data['where']; 
  10.          } else { 
  11.              $thumb = intval($data['thumb']) ? " AND thumb != ''" : ''
  12.              if($this->category[$catid]['child']) { 
  13.                  $catids_str = $this->category[$catid]['arrchildid']; 
  14.                  $pos = strpos($catids_str,',')+1; 
  15.                  $catids_str = substr($catids_str$pos); 
  16.                  $sql = "status=99 AND catid IN ($catids_str)".$thumb
  17.              } else { 
  18.                  $sql = "status=99 AND catid='$catid'".$thumb
  19.              } 
  20.          } 
  21.          $order = $data['order']; 
  22.   
  23.          $return = $this->db->select($sql'*'$data['limit'], $order'''id'); 
  24.                           
  25.          //調(diào)用副表的數(shù)據(jù) 
  26.          if (isset($data['moreinfo']) && intval($data['moreinfo']) == 1) { 
  27.              $ids = array(); 
  28.              foreach ($return as $v) { 
  29.                  if (isset($v['id']) && !emptyempty($v['id'])) { 
  30.                      $ids[] = $v['id']; 
  31.                  } else { 
  32.                      continue
  33.                  } 
  34.              } 
  35.              if (!emptyempty($ids)) { 
  36.                  $this->db->table_name = $this->db->table_name.'_data'
  37.                  $ids = implode('/',/''$ids); 
  38.                  $r = $this->db->select("`id` IN ('$ids')"'*''''''''id'); 
  39.                  if (!emptyempty($r)) { 
  40.                      foreach ($r as $k=>$v) { 
  41.                          if (isset($return[$k])) $return[$k] = array_merge($v$return[$k]); 
  42.                      } 
  43.                  } 
  44.              } 
  45.          } 
  46.          return $return
  47.      } 
修改為:
  1. /** 
  2.       * 列表頁標(biāo)簽 
  3.       * @param $data 
  4.       */ 
  5.      public function lists($data) { 
  6.          $catid = intval($data['catid']); 
  7.           
  8.          if(isset($data['where'])) { 
  9.              $sql = $data['where']; 
  10.          } else { 
  11.              $thumb = intval($data['thumb']) ? " AND thumb != ''" : ''
  12.              if(!emptyempty($catid)) { 
  13.                  if(!$this->set_modelid($catid)) return false; 
  14.                  if($this->category[$catid]['child']) { 
  15.                      $catids_str = $this->category[$catid]['arrchildid']; 
  16.                      $pos = strpos($catids_str,',')+1; 
  17.                      $catids_str = substr($catids_str$pos); 
  18.                      $sql = "status=99 AND catid IN ($catids_str)".$thumb
  19.                  } else { 
  20.                      $sql = "status=99 AND catid='$catid'".$thumb
  21.                  } 
  22.              } 
  23.              else { 
  24.                  $sql = "status=99".$thumb
  25.              } 
  26.                   
  27.          } 
  28.          $order = $data['order']; 
  29.   
  30.          $return = $this->db->select($sql'*'$data['limit'], $order'''id'); 
  31.                           
  32.          //調(diào)用副表的數(shù)據(jù) 
  33.          if (isset($data['moreinfo']) && intval($data['moreinfo']) == 1) { 
  34.              $ids = array(); 
  35.              foreach ($return as $v) { 
  36.                  if (isset($v['id']) && !emptyempty($v['id'])) { 
  37.                      $ids[] = $v['id']; 
  38.                  } else { 
  39.                      continue
  40.                  } 
  41.              } 
  42.              if (!emptyempty($ids)) { 
  43.                  $this->db->table_name = $this->db->table_name.'_data'
  44.                  $ids = implode('/',/''$ids); 
  45.                  $r = $this->db->select("`id` IN ('$ids')"'*''''''''id'); 
  46.                  if (!emptyempty($r)) { 
  47.                      foreach ($r as $k=>$v) { 
  48.                          if (isset($return[$k])) $return[$k] = array_merge($v$return[$k]); 
  49.                      } 
  50.                  } 
  51.              } 
  52.          } 
  53.          return $return
  54.      } 
修改代碼后,即能調(diào)取全站最新文章。
調(diào)用方法:{pc:content action="lists" num="10" order="id DESC" cache="3600"}
發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 会东县| 贵定县| 临汾市| 谢通门县| 溧阳市| 伊吾县| 仙桃市| 杭州市| 禄劝| 桂阳县| 高雄县| 右玉县| 互助| 治多县| 江油市| 慈溪市| 仙居县| 南宫市| 板桥市| 泉州市| 修武县| 界首市| 都江堰市| 建德市| 江西省| 廊坊市| 阳高县| 德令哈市| 诸城市| 深泽县| 山西省| 沅江市| 仙居县| 政和县| 文成县| 珲春市| 夏河县| 科尔| 斗六市| 榆树市| 赣州市|