DedeCMS列表分頁首頁和其他分頁使用不同模板的方法有兩種。前面寫過利用{dede:pagelist}標(biāo)簽寫PHP語句,DedeCMS列表分頁標(biāo)題第一頁與首頁內(nèi)容重復(fù),缺點是不能使用嵌套其他標(biāo)簽;下面是另一種實用方法,支持動態(tài)、靜態(tài)模板。
動態(tài)模板修改
打開include/arc.listview.class.php,找到
$this->ParseTempletsFirst();
上面添加
if($this->PageNo>1){ $tmpdir = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']; $tempfile = str_replace("{tid}",$this->TypeID,$this->Fields['templist']); $tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile); $tempfile = $tmpdir."/".$tempfile; $tmpfile2 = substr($tempfile,0,-4); $tempfile = $tmpfile2."2.htm"; $this->dtp->LoadTemplate($tempfile); }
靜態(tài)模板修改
繼續(xù)在arc.listview.class.php找到
$this->ParseDMFields($this->PageNo,1);
上面添加
if($this->PageNo>1){ $tmpdir = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']; $tempfile = str_replace("{tid}",$this->TypeID,$this->Fields['templist']); $tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile); $tempfile = $tmpdir."/".$tempfile; $tmpfile2 = substr($tempfile,0,-4); $tempfile = $tmpfile2."2.htm"; $this->dtp->LoadTemplate($tempfile); $this->ParseTempletsFirst(); }
說明
系統(tǒng)識別當(dāng)前內(nèi)容模型后面加2的模板作為其他分頁模板,比如:list_article.htm為第一頁模板,list_article2.htm為其他分頁模板。