上门一对一计算机家教
当前位置: 首页 > dedecms家教 >

在dedecms首页和列表页、内容页上调用文章的副栏目名称

点击: 时间:2013-10-14 来源:北京家教网
在内容页的标签: {dede:field.typeid2 runphp='yes'} $dsql= new dedesql(); $ks = split(',', @me); $type2name=""; foreach($ks as $k){ $k = trim($k); if ($k!="") { if ($row = $dsql-getOne("select *,ID as id1 from dede_arctype
在内容页的标签:
{dede:field.typeid2 runphp='yes'}
$dsql= new dedesql();
$ks = split(',', @me);
$type2name="";
foreach($ks as $k){
$k = trim($k);
if ($k!="") {
if ($row = $dsql->getOne("select *,ID as id1 from dede_arctype where id=".$k)){
$type_path=GetTypeUrl($row['id1'],MfTypedir($row['typedir']),$row['isdefault'],$row['defaultname'],$row['ispart'],$row['namerule2'],$row['siteurl']);
$type2name.="<a href='".$type_path."'target=_blank>".$row['typename']."</a> ";
}
}
}
@me=substr($type2name,0,strlen($type2name)-1);
{/dede:field.typeid2}


首页、列表页标签(在arclist、list等文章列表标签里用):

[field:typeid2runphp='yes']
$dsql= new dedesql();
$ks = split(',', @me);
$type2name="";
foreach($ks as $k){
$k = trim($k);
if ($k!="") {
if ($row = $dsql->getOne("select *,ID as id1 from dede_arctype where id=".$k)){
$type_path=GetTypeUrl($row['id1'],MfTypedir($row['typedir']),$row['isdefault'],$row['defaultname'],$row['ispart'],$row['namerule2'],$row['siteurl']);
$type2name.="<a href='".$type_path."'target=_blank>".$row['typename']."</a> ";
}
}
}
@me=substr($type2name,0,strlen($type2name)-1);
[/field:typeid2]

[/post]
------分隔线----------------------------