在使用织梦5.7系统做网站时,会经常用到{dede:channel}标签,有时我们需要调用栏目seotitle字段。比如说:
{dede:channel type=’sun’ typeid=’1’}
<a href=http://www.dede58.com/’[field:typelink/]’>[field:typename/]</a>
{/dede:channel}
[field:typename/]这里要使用{dede:field.seotitle /},也就是说在织梦{dede:channel}标签中调用栏目seotitle,如何实现?
如果要想在织梦{dede:channel}标签中调用栏目seotitle,我们需要做一下简单的二次开发,步骤如下:
打开/include/taglib文件夹下的channel.lib.php,找到78行到94行:
if($type==’top’)
{
$sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
From `zuimoban_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 `zuimoban_arctype` WHERE reid=’typeid′Andishidden<>1orderbysortrankasclimit0,typeid′Andishidden<>1orderbysortrankasclimit0,line ";
}
else if($type==’self’)
{
if($reid==0) return ’’;
$sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath
FROM `zuimoban_arctype` WHERE reid=’reid′Andishidden<>1orderbysortrankasclimit0,reid′Andishidden<>1orderbysortrankasclimit0,line ";
}
在sql语句里补充:Select id,typename,seotitle,.......就可以调用,如下图: