|
dedecms调用上级栏目名称和链接的方法
动态调用:
- <p>{dede:type} </p><p>[field:id runphp=yes] </p><p>$tsql = new DedeSql(false); </p><p>$typelink2 = ''; </p><p>$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'"); </p><p>$tsql->Execute('t'); </p><p>while($row = $tsql->GetArray('t',MYSQL_ASSOC)) </p><p>{ </p><p>$typelink2 .= "<a href='list.php?tid=".$row['id']."'>".$row['typename']."</a>"; </p><p>} </p><p>@me=$typelink2; </p><p>[/field:id]{/dede:type} </p>
复制代码
静态调用:
- <p>{dede:type} </p><p>[field:id runphp=yes] </p><p>$tsql = new DedeSql(false); </p><p>$typelink2 = ''; </p><p>$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'"); </p><p>$tsql->Execute('t'); </p><p>while($row = $tsql->GetArray('t',MYSQL_ASSOC)) </p><p>{ </p><p>$typelink2 .= "<a href='".$row['typedir']."'>".$row['typename']."</a>"; </p><p>} </p><p>@me=str_replace("{cmspath}","",$typelink2); </p><p>[/field:id] </p><p>{/dede:type} </p>
复制代码
|
|