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

2017-04-13 21:02:29 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}