phpcms v9 根据日期调用全站文章url
作者:互联网
- 新增模版
- 新建一个list2.html(里面内容如下代码)放到模版里
-
{pc:content action="lists" catid="$catid" ccc="1" date="$_GET['date']" order="id DESC" num="100000"} {loop $data $v} {$v['url']}<br> {/loop} {/pc}
- 新增栏目
- 内容-管理栏目-添加栏目-随便新增一个文章栏目-栏目列表页模板list2.html
- 新增代码
- 代码路径 /phpcms/modules/content/classes/content_tag.class.php 替换lists方法
-
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 { if($data['ccc']==1){ $sj = $data['date']; $s = strtotime($sj.'00:00:00'); $l = strtotime($sj.'23:59:59'); $sql = "status=99 AND inputtime>=$s AND inputtime<=$l".$thumb; }else{ $sql = "status=99 AND catid='$catid'".$thumb; } } } $order = $data['order']; $return = $this->db->select($sql, '*', $data['limit'], $order, '', 'id'); //调用副表的数据 if (isset($data['moreinfo']) && intval($data['moreinfo']) == 1) { $ids = array(); foreach ($return as $v) { if (isset($v['id']) && !empty($v['id'])) { $ids[] = $v['id']; } else { continue; } } if (!empty($ids)) { $this->db->table_name = $this->db->table_name.'_data'; $ids = implode('\',\'', $ids); $r = $this->db->select("`id` IN ('$ids')", '*', '', '', '', 'id'); if (!empty($r)) { foreach ($r as $k=>$v) { if (isset($return[$k])) $return[$k] = array_merge($v, $return[$k]); } } } } return $return; }
网址调用方法:
-
http://www.123.com/index.php?m=content&c=index&a=lists&catid=61&date=2021-11-21
标签:全站,return,catid,url,catids,ids,phpcms,data,id 来源: https://blog.csdn.net/qq506874511/article/details/123174373