發(fā)表日期:2019-12 文章編輯:小燈 瀏覽次數(shù):4328
Phpcms默認不支持調用全站最新文章,需要修改文件:\phpcms\modules\content\classes\content_tag.class.php,找到以下函數(shù):
修改為:
- /**
- * 列表頁標簽
- * @param $data
- */
- public function lists($data) {
- $catid = intval($data['catid']);
- if(!$this->set_modelid($catid)) return false;
- if(isset($data['where'])) {
- $sql = $data['where'];
- } else {
- $thumb = intval($data['thumb']) ? " AND thumb != ''" : '';
- if($this->category[$catid]['child']) {
- $catids_str = $this->category[$catid]['arrchildid'];
- $pos = strpos($catids_str,',')+1;
- $catids_str = substr($catids_str, $pos);
- $sql = "status=99 AND catid IN ($catids_str)".$thumb;
- } else {
- $sql = "status=99 AND catid='$catid'".$thumb;
- }
- }
- $order = $data['order'];
- $return = $this->db->select($sql, '*', $data['limit'], $order, '', 'id');
- //調用副表的數(shù)據(jù)
- if (isset($data['moreinfo']) && intval($data['moreinfo']) == 1) {
- $ids = array();
- foreach ($return as $v) {
- if (isset($v['id']) && !emptyempty($v['id'])) {
- $ids[] = $v['id'];
- } else {
- continue;
- }
- }
- if (!emptyempty($ids)) {
- $this->db->table_name = $this->db->table_name.'_data';
- $ids = implode('\',\'', $ids);
- $r = $this->db->select("`id` IN ('$ids')", '*', '', '', '', 'id');
- if (!emptyempty($r)) {
- foreach ($r as $k=>$v) {
- if (isset($return[$k])) $return[$k] = array_merge($v, $return[$k]);
- }
- }
- }
- }
- return $return;
- }
修改代碼后,即能調取全站最新文章。
- /**
- * 列表頁標簽
- * @param $data
- */
- public function lists($data) {
- $catid = intval($data['catid']);
- if(isset($data['where'])) {
- $sql = $data['where'];
- } else {
- $thumb = intval($data['thumb']) ? " AND thumb != ''" : '';
- if(!emptyempty($catid)) {
- if(!$this->set_modelid($catid)) return false;
- if($this->category[$catid]['child']) {
- $catids_str = $this->category[$catid]['arrchildid'];
- $pos = strpos($catids_str,',')+1;
- $catids_str = substr($catids_str, $pos);
- $sql = "status=99 AND catid IN ($catids_str)".$thumb;
- } else {
- $sql = "status=99 AND catid='$catid'".$thumb;
- }
- }
- else {
- $sql = "status=99".$thumb;
- }
- }
- $order = $data['order'];
- $return = $this->db->select($sql, '*', $data['limit'], $order, '', 'id');
- //調用副表的數(shù)據(jù)
- if (isset($data['moreinfo']) && intval($data['moreinfo']) == 1) {
- $ids = array();
- foreach ($return as $v) {
- if (isset($v['id']) && !emptyempty($v['id'])) {
- $ids[] = $v['id'];
- } else {
- continue;
- }
- }
- if (!emptyempty($ids)) {
- $this->db->table_name = $this->db->table_name.'_data';
- $ids = implode('\',\'', $ids);
- $r = $this->db->select("`id` IN ('$ids')", '*', '', '', '', 'id');
- if (!emptyempty($r)) {
- foreach ($r as $k=>$v) {
- if (isset($return[$k])) $return[$k] = array_merge($v, $return[$k]);
- }
- }
- }
- }
- return $return;
- }
日期:2019-12 瀏覽次數(shù):4779
日期:2019-12 瀏覽次數(shù):4205
日期:2019-12 瀏覽次數(shù):3948
日期:2019-12 瀏覽次數(shù):4193
日期:2019-12 瀏覽次數(shù):4327
日期:2019-12 瀏覽次數(shù):4105
日期:2019-12 瀏覽次數(shù):4379
日期:2019-12 瀏覽次數(shù):4021
日期:2019-12 瀏覽次數(shù):4531
日期:2019-12 瀏覽次數(shù):4544
日期:2019-12 瀏覽次數(shù):4304
日期:2019-12 瀏覽次數(shù):4866
日期:2019-12 瀏覽次數(shù):4273
日期:2019-12 瀏覽次數(shù):4085
日期:2019-12 瀏覽次數(shù):4163
日期:2019-12 瀏覽次數(shù):4068
日期:2019-12 瀏覽次數(shù):4346
日期:2019-12 瀏覽次數(shù):4151
日期:2019-12 瀏覽次數(shù):4176
日期:2019-12 瀏覽次數(shù):5540
日期:2019-12 瀏覽次數(shù):4630
日期:2019-12 瀏覽次數(shù):4015
日期:2019-12 瀏覽次數(shù):4044
日期:2019-12 瀏覽次數(shù):4128
日期:2019-12 瀏覽次數(shù):4856
日期:2019-12 瀏覽次數(shù):3990
日期:2019-12 瀏覽次數(shù):3934
日期:2019-12 瀏覽次數(shù):4245
日期:2019-12 瀏覽次數(shù):3850
日期:2019-12 瀏覽次數(shù):4147
Copyright ? 2013-2018 Tadeng NetWork Technology Co., LTD. All Rights Reserved.