開啟檔案
/include/taglib/channel.lib.php
找到程式碼
else if($type=='self') { if($reid==0) return ''; $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `#@__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 "; }接著就可以在模板中呼叫父級欄位和父級頂級欄位了:
{dede:channel type='fatherlist'}[field:typename/]{/dede:channel}
{dede:channel type='topone'}[field:typename/]{/dede:channel}
版權聲明:本文為博主原創文章,未經博主允許不得轉載。
以上就介紹了織夢調用父級欄位連結和名稱,包括了方面的內容,希望對PHP教程有興趣的朋友有所幫助。