自拍亚洲一区欧美另类,亚洲成人影院,亚洲午夜久久久久妓女影院,最近中文字幕高清中文字幕无,亚洲熟妇av一区二区三区漫画

學(xué)習(xí)筆記

精準(zhǔn)傳達(dá) ? 價(jià)值共享

洞悉互聯(lián)網(wǎng)前沿資訊,探尋網(wǎng)站營銷規(guī)律

織夢欄目列表頁實(shí)現(xiàn)第一頁與其他頁調(diào)用不同模板文件

作者:狐靈科技 | 2019-12-24 10:29 |點(diǎn)擊:

織夢欄目列表頁第一頁+分頁條效果

織夢列表頁實(shí)現(xiàn)第一頁與其他頁調(diào)用不同模板

織夢欄目列表頁第二頁和其他頁

織夢列表頁實(shí)現(xiàn)第一頁與其他頁調(diào)用不同模板

前面有教程講到欄目列表頁第一個(gè)文檔與其他文檔不同教程《織夢列表頁 第一篇文章與其他文章樣式不同

這次教程實(shí)現(xiàn)的是第一頁的模板與其他第二頁、第三頁、、、后面的頁調(diào)用的不同模板,分開為2個(gè)欄目列表模板,此教程支持欄目頁動(dòng)態(tài)、靜態(tài)、偽靜態(tài)下使用。

第一步 修改核心文件

打開 /include/arc.listview.class.php 找到,大概在第330行

$this->ParseDMFields($this->PageNo,1);

在它的上面加入

$tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$this->TypeLink->TypeInfos['templist'];
$tempfile = str_replace("{tid}"$this->TypeID, $tempfile);
$tempfile = str_replace("{cid}"$this->ChannelUnit->ChannelInfos['nid'], $tempfile);
if ( defined('DEDEMOB') )
{
$tempfile =str_replace('.htm','_m.htm',$tempfile);
}
if(!file_exists($tempfile))
{
$tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$GLOBALS['cfg_df_style']."/list_default.htm";
if ( defined('DEDEMOB') )
{
$tempfile =str_replace('.htm','_m.htm',$tempfile);
}
}
if(!file_exists($tempfile)||!is_file($tempfile))
{
echo $this->Fields['typename']." [ID:{$this->TypeID}] ".$GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$this->TypeLink->TypeInfos['templist']."模板文件不存在,無法解析文檔!";
exit();
}
if$this->PageNo===1 )
{
$tempfile2 =str_replace('.htm','_1.htm',$tempfile);
if(file_exists($tempfile2) && is_file($tempfile2))
{
$this->dtp->LoadTemplate($tempfile2);
$this->ParseTempletsFirst();
}
}
else
{
$this->dtp->LoadTemplate($tempfile);
}

如圖

織夢列表頁實(shí)現(xiàn)第一頁與其他頁調(diào)用不同模板

繼續(xù)找到,大概在第450行的

$this->ParseTempletsFirst();

注意是在第450行左右的這個(gè)代碼,因?yàn)檫@個(gè)代碼有3處,請(qǐng)認(rèn)準(zhǔn)是在大概第450行上這個(gè)

找到后在它的上面加入

$tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$this->TypeLink->TypeInfos['templist'];
$tempfile = str_replace("{tid}"$this->TypeID, $tempfile);
$tempfile = str_replace("{cid}"$this->ChannelUnit->ChannelInfos['nid'], $tempfile);
if ( defined('DEDEMOB') )
{
$tempfile =str_replace('.htm','_m.htm',$tempfile);
}
if(!file_exists($tempfile))
{
$tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$GLOBALS['cfg_df_style']."/list_default.htm";
if ( defined('DEDEMOB') )
{
$tempfile =str_replace('.htm','_m.htm',$tempfile);
}
}
if(!file_exists($tempfile)||!is_file($tempfile))
{
echo $this->Fields['typename']." [ID:{$this->TypeID}] ".$GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$this->TypeLink->TypeInfos['templist']."模板文件不存在,無法解析文檔!";
exit();
}
if$this->PageNo===1 )
{
$tempfile2 =str_replace('.htm','_1.htm',$tempfile);
if(file_exists($tempfile2) && is_file($tempfile2))
{
$this->dtp->LoadTemplate($tempfile2);
}
}
else
{
$this->dtp->LoadTemplate($tempfile);
}

如圖

織夢列表頁實(shí)現(xiàn)第一頁與其他頁調(diào)用不同模板

第二步 添加第一頁模板文件及命名

第一頁模板,在原欄目列表模板后面加_1

例如,原列表模板是 list_dongwu.htm

如果你想讓第一頁跟list_dongwu.htm不一樣的話,你可以建立一個(gè)

list_dongwu_1.htm

系統(tǒng)在動(dòng)態(tài)或者生成靜態(tài)時(shí),欄目列表第一頁優(yōu)先去找這個(gè) _1 的第一頁模板文件,存在就輸出,不存在就使用默認(rèn)的原列表模板 list_dongwu.htm

第三步 更新生成

更新系統(tǒng)緩存,靜態(tài)的生成,動(dòng)態(tài)的直接查看效果

 

 
如沒特殊注明,文章均為狐靈科技原創(chuàng),轉(zhuǎn)載請(qǐng)注明?? "織夢欄目列表頁實(shí)現(xiàn)第一頁與其他頁調(diào)用不同模板文件
多一份免費(fèi)策劃方案,總有益處。

請(qǐng)直接添加技術(shù)總監(jiān)微信聯(lián)系咨詢

網(wǎng)站設(shè)計(jì) 品牌營銷

多一份參考,總有益處

聯(lián)系狐靈科技,免費(fèi)獲得專屬《策劃方案》及報(bào)價(jià)

咨詢相關(guān)問題或預(yù)約面談,可以通過以下方式與我們聯(lián)系

業(yè)務(wù)熱線:15082661954 / 大客戶專線:15523356218