{dede:channelartlist typeid='栏目ID' row='条数'}
{dede:sql sql='Select * from dede_arctype where reid=~id~ ORDER BY id limit 0,7'}
[field:typename/]{/dede:sql}
{/dede:channelartlist}
代码功能:父栏目及子栏目同时调用
使用说明……typeid,row
如果[field:typedir/]中含有{cmspath}而使链接无效,请使用[field:typedir function='str_replace("{cmspath}","",@me)'/] 此标签替换[field:typedir/]。
{dede:field name='typedir' runphp='yes'}
@me=str_replace("{cmspath}","",@me);
{/dede:field}
一、二、三级栏目调用
{dede:channelartlist typeid=top row=4}
{dede:sql sql='Select * from dede_arctype where reid=~id~ ORDER BY id limit 0,7'}
[field:typename/]{/dede:sql}
{/dede:channelartlist}
主栏目调用
{dede:channelartlist typeid=top row=''}
{dede:field name='typename'/}{dede:sql sql='Select * from dede_arctype where reid=~id~ ORDER BY id limit 0,7'}
[field:array runphp='yes']@me = (!empty(@me['reid']) ? "" : "
{@me['typename']}"); [/field:array]{/dede:sql}
{/dede:channelartlist}
在列表页和内容页调用顶级栏目名称方法
{dede:field.typeid runphp='yes' function="GetTopid(@me)"}
$dsql = new DedeSql(false);
$a="SELECT typename FROM dedemuban_arctype where id=@me";
$arcRow = $dsql->GetOne($a);
@me=$arcRow[typename];{/dede:field.typeid}
根据下级栏目获得顶级栏目名称的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}
怎么在首页调用dede子栏目
{dede:channel type='son' typeid='栏目ID'}
{/dede:channel}
例如同时调用顶级栏目,全站文章和顶级栏目下的子栏目:
{dede:channel type='top' row='800'}
{/dede:channel}
{dede:arclist row='80000' titlelen='40' orderby='pubdate' idlist=''}
[field:textlink/],1
{/dede:arclist}
{dede:channelartlist row='3000'}
{dede:sql sql='Select * from dede_arctype where reid=~id~ ORDER BY id limit 0,3000'}
{/dede:sql}