|
在开发织梦模板的时候,在调用 dede:channel标签时,需要将栏目中 seotitle中的内容也可以调用出来。默认是不支持调用的。做了一下二次开发,让channel标签支持seotitle的调用。
开发方法如下:
1、打开 include/taglib/channel.lib.php,找到如下代码:
if($type=='top')
{
$sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl]sitepath
From `dede_arctype` WHERE reid=0 And ishidden1 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 `dede_arctype` WHERE reid='$typeid' And ishidden1 order by sortrank asc limit 0] $line ";
}
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 ishidden1 order by sortrank asc limit 0] $line ";
}
修改为:
if($type=='top')
{
$sql = "SELECT id,typename,seotitle,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl]sitepath
From `dede_arctype` WHERE reid=0 And ishidden1 order by sortrank asc limit 0] $line ";
}
else if($type=='son')
{
if($typeid==0) return '';
$sql = "SELECT id,typename,seotitle,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl]sitepath
From `dede_arctype` WHERE reid='$typeid' And ishidden1 order by sortrank asc limit 0] $line ";
}
else if($type=='self')
{
if($reid==0) return '';
$sql = "SELECT id,typename,seotitle,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl]sitepath
FROM `dede_arctype` WHERE reid='$reid' And ishidden1 order by sortrank asc limit 0] $line ";
}
前台模板调用方法:
{dede:channel type='top' row='10'}
[*,[url=[field:typeurl/],[field:typename/]
[field:seotitle/][/url]
{/dede:channel}
完成。 |
|