主頁 > 網(wǎng)站建設(shè) > 建站知識(shí) > 織夢(mèng)調(diào)用父級(jí)欄目鏈接和名稱

織夢(mèng)調(diào)用父級(jí)欄目鏈接和名稱

POST TIME:2017-11-13 00:04

打開文件

/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 `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 ";
}

然后就可以在模板中調(diào)用父級(jí)欄目和父級(jí)頂級(jí)欄目了:

{dede:channel type='fatherlist'}[field:typename/]{/dede:channel}


{dede:channel type='topone'}[field:typename/]{/dede:channel}



收縮
  • 微信客服
  • 微信二維碼
  • 電話咨詢

  • 400-1100-266