您好,登錄后才能下訂單哦!
小編給大家分享一下DEDECMS列表頁如何調(diào)用當(dāng)前欄目父級欄目,希望大家閱讀完這篇文章后大所收獲,下面讓我們一起去探討吧!
DEDECMS列表頁怎么調(diào)用當(dāng)前欄目父級欄目?
修改方法如下
首先找到下面的代碼:
if($type=='top') { $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath From `dede_arctype` WHERE reid=0 And ishidden<>1 order by sortrank asc limit 0, $line "; } else if($type=='son') { if($typeid==0) return ''; $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath From `dede_arctype` WHERE reid='$typeid' And ishidden<>1 order by sortrank asc limit 0, $line "; } else if($type=='self') { if($reid==0) return ''; $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `dede_arctype` WHERE reid='$reid' And ishidden<>1 order by sortrank asc limit 0, $line "; }
然后將下面代碼拷貝到其后面:
代碼如下:
else if($type=='topone') { if($reid==0) return ''; $rowR = $dsql->GetOne("SELECT * FROM `dede_arctype` WHERE id='$typeid' "); $topids = $rowR['topid']; $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `dede_arctype` WHERE reid='0' And id='$topids' And ishidden<>1 order by sortrank asc limit 0, $line "; } else if($type=='fatherlist') { $rowR = $dsql->GetOne("SELECT * FROM `dede_arctype` WHERE id='$typeid' "); $reid = $rowR['reid']; $rowR = $dsql->GetOne("SELECT * FROM `dede_arctype` WHERE id='$reid' "); $reid = $rowR['reid']; $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `dede_arctype` WHERE reid='$reid' And ishidden<>1 order by sortrank asc limit 0, $line "; }
說明topone是調(diào)用當(dāng)前目錄對應(yīng)的頂級目錄'fatherlist' 是調(diào)用上一級目錄,當(dāng)前目錄對應(yīng)的頂級目錄標(biāo)記:
代碼如下:
{dede:channel type='topone'}[field:typename/]{/dede:channel}
這個方法絕對可以,如果想用鏈接的話,就要[field:typeurl].
看完了這篇文章,相信你對DEDECMS列表頁如何調(diào)用當(dāng)前欄目父級欄目有了一定的了解,想了解更多相關(guān)知識,歡迎關(guān)注億速云行業(yè)資訊頻道,感謝各位的閱讀!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。