• [织梦吧]唯一域名:www.dedecms8.com,织梦DedeCMS学习平台.

当前位置: > DedeCMS教程 > Dedecms二次开发 >

织梦调用父级栏目链接和名称

来源: www.dedecms8.com 编辑:织梦吧 时间:2019-11-18点击:

打开文件

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

}

然后就可以在模板中调用父级栏目和父级顶级栏目了:

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

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

标签:

About D8

  • ©2014 织梦吧(d8) DedeCMS学习交流平台
  • 唯一网址 www.DedeCMS8.com 网站地图
  • 联系我们 1170734538@qq.com ,  QQ