各种栏目名称的调用方法:
1、{dede:field name="typename"} 这是调用当前栏目的名称
2、{dede:channel type='son' row='5'} [field:typename/] {/dede:channel} 这是调用该顶级频道下所有字栏目,row代表调用5条
3、{dede:type typeid='栏目id'} [field:typename/] {/dede:type} 表示调用指定id的栏目,不过只能调用一个,要想多个调用就只能重复多次调用该标签
4、 {dede:channel type='top'}[field:typename/] {/dede:channel}调用子栏目的当前顶级栏目名称
下面是调用顶级栏目名称的方法:
方法一:
{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}
织梦者重点推荐方法二
方法二:
{dede:field.title runphp=’yes’}list($toptype,$sontype)=split(‘/’,@me);@me=$toptype;{/dede:field.title}
方法三:
{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]"; $topID="$row[topid]"; if($relID == 0) {@me = $row[typename];}else{$sql = "SELECT `typename` FROM `dede_arctype` WHERE id=$topID";$query = mysql_query($sql);$row=mysql_fetch_array($query); @me = $row[typename];}{/dede:field.typeid}