{dede:channelartlist typeid='栏目ID' row='条数'}
<div class="list"> 代码功能:父栏目及子栏目同时调用 使用说明……typeid,row 如果[field:typedir/]中含有{cmspath}而使链接无效,请使用[field:typedir function='str_replace("{cmspath}","",@me)'/] 此标签替换[field:typedir/]。 {dede:field name='typedir' runphp='yes'} 网上搜集的栏目调用代码: 一、二、三级栏目调用 主栏目调用 在列表页和内容页调用顶级栏目名称方法 {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子栏目
<li><a href="{dede:field name='typeurl'/}">{dede:field name='typename'/}</a></li>
<ul>
{dede:sql sql='Select * from dede_arctype where reid=~id~ ORDER BY id limit 0,7'}
<li><a href='[field:typedir/]' target='_blank'>[field:typename/]</a></li>
{/dede:sql}
</ul>
</div>
{/dede:channelartlist}
@me=str_replace("{cmspath}","",@me);
{/dede:field}
{dede:channelartlist typeid=top row=4}
<div class="cpmll">
<span><a href="{dede:field name='typeurl'/}">{dede:field name='typename'/}</a></span>
<ul>
{dede:sql sql='Select * from dede_arctype where reid=~id~ ORDER BY id limit 0,7'}
<li><a href='[field:typedir/]' target='_blank'>[field:typename/]</a></li>
{/dede:sql}
</ul>
</div>
{/dede:channelartlist}
{dede:channelartlist typeid=top row=''}
<li><a href="{dede:field name='typeurl'/}">{dede:field name='typename'/}</a>
<ul>
{dede:sql sql='Select * from dede_arctype where reid=~id~ ORDER BY id limit 0,7'}
[field:array runphp='yes']@me = (!empty(@me['reid']) ? "" : "<li><a href='{@me['typedir']}' target='_blank'>{@me['typename']}</a></li>"); [/field:array]
{/dede:sql}
</ul>
</li>
{/dede:channelartlist}
{dede:field.typeid runphp='yes' function="GetTopid(@me)"}
$dsql = new DedeSql(false);
$a="SELECT typename FROM dede_arctype where id=@me";
$arcRow = $dsql->GetOne($a);
@me=$arcRow[typename];{/dede:field.typeid}
根据下级栏目获得顶级栏目名称的SQL语句
{dede:channel type='son' typeid='栏目ID'}
<a href="[field:typelink/]">[field:typename/]</a>
{/dede:channel}