码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2015-08-20 07:58:28      阅读:180      评论:0      收藏:0      [点我收藏+]

标签:织梦   php   

打开文件
/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   

原文地址:http://blog.csdn.net/nancle/article/details/47802295

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!