dedecms5.7循环输出一二级分类

凤凰学院整理发布

2020-06-09

<nav id="menu">
<ul>
<li class="Selected"><a href="/">首页</a></li>
{dede:channelartlist typeid="top"}
<li><a href="{dede:field name="typeurl"/}">{dede:field name="typename"/}</a>
{dede:field name=typeid runphp="yes"}
global $dsql;
$sql = "SELECT id From `dede_arctype` WHERE reid='@me' And ishidden<>1 order by sortrank asc limit 0, 100 ";
$row = $dsql->GetOne($sql);      
@me=is_array($row)?'<ul>':'';
{/dede:field}
{dede:channel type="son"}
<li><a href="[field:typeurl/]">[field:typename/]</a></li>
{/dede:channel}
{dede:field name=typeid runphp="yes"}
global $dsql;
$sql = "SELECT id From `dede_arctype` WHERE reid='@me' And ishidden<>1 order by sortrank asc limit 0, 100 ";
$row = $dsql->GetOne($sql);      
@me=is_array($row)?'</ul>':'';
{/dede:field}
</li>{/dede:channelartlist}
</ul>
</nav>