在DEDE栏目页或者内容页中调用当前栏目的父级栏目名称:
静态页
复制代码{dede:type}
[field:id runphp=yes]
$tsql = new DedeSql(false);
$typelink2 = '';
$tsql->SetQuery("Select i.typedir,i.id,i.typename From #@__arctype t left join #@__arctype i on i.id=t.reid where t.id='@me'");
$tsql->Execute('t');
while($row = $tsql->GetArray('t',MYSQL_ASSOC))
{
$typelink2 .= "".$row['typename']."";
}
@me=str_replace("{cmspath}","",$typelink2);
[/field:id]
{/dede:type}
动态页:
复制代码{dede:type}
[field:id runphp=yes]
$tsql = new DedeSql(false);
$typelink2 = '';
$tsql->SetQuery("Select i.typedir,i.id,i.typename From #@__arctype t left join #@__arctype i on i.id=t.reid where t.id='@me'");
$tsql->Execute('t');
while($row = $tsql->GetArray('t',MYSQL_ASSOC))
{
$typelink2 .= "".$row['typename']."";
}
@me=$typelink2;
[/field:id]
{/dede:type}