织梦DEDECMS模板根据下级栏目获得顶级栏目名称的代码

SQL语句语句实现

{dede:field.typeid runphp='yes'}$ID = @me; $sql = "SELECT * FROM `dede_arctype` WHERE id=$ID"; $query = mysql_query($sql);$row=mysql_fetch_array($query); $relID = "$row[reid]"; if($relID == 0) { @me = $row[typename];}else{$sql = "SELECT `typename` FROM `dede_arctype` WHERE id=$relID"; $query = mysql_query($sql);$row=mysql_fetch_array($query); @me = $row[typename];}{/dede:field.typeid  

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/10c43437b21cc178847087e118ebf2f1.html