Dedecms 调用上级栏目名称和链接的方法

Dedecms文章列表页调用上级栏目的名称和链接如何调用?

  动态页:

 

以下为引用的内容:
{dede:type}
[field:id runphp=yes]
    $tsql = new DedeSql(false);
    $typelink2 = '';
    $tsql->SetQuery("Select i.typedir,i.id,i.typename From dede_arctype t left join dede_arctype i on i.id=t.reid where t.id='@me'");
    $tsql->Execute('t');
    while($row = $tsql->GetArray('t',MYSQL_ASSOC))
    {
       $typelink2 .= "<a href='list.php?tid=".$row['id']."'>".$row['typename']."</a>";
    }
    @me=$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 dede_arctype t left join dede_arctype i on i.id=t.reid where t.id='@me'");
    $tsql->Execute('t');
    while($row = $tsql->GetArray('t',MYSQL_ASSOC))
    {
       $typelink2 .= "<a href='".$row['typedir']."'>".$row['typename']."</a>";
    }
    @me=str_replace("{cmspath}","",$typelink2);
[/field:id]
{/dede:type}