其实织梦DEDECMS是一个很强大的CMS系统,很多站长都喜欢用它建站。然而在用织梦做网站时,站长们经常会碰到需要在当前页面调用顶级栏目名称的时候,织梦默认{dede:field name=typename
{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'].""; $url=$cfg_basehost.$cfg_cmspath;@me=str_replace('{cmspath}', $url,@me); } else { $sql = "SELECT * FROM `dede_arctype` WHERE id=$relID";$query = mysql_query($sql);$row=mysql_fetch_array($query); @me = "".$row['typename'].""; $url=$cfg_basehost.$cfg_cmspath;@me=str_replace('{cmspath}',$url,@me); } {/dede:field.typeid}