[php]代码库
顶级导航:
{pc:content action="category" catid="0" num="25" siteid="$siteid" order="listorder ASC"}
<ul class="nav-site">
<li><a href="{siteurl($siteid)}"><span>首页</span></a></li>
{loop $data $r}
<li><a href="{$r[url]}"><span>{$r[catname]}</span></a></li>
{/loop}
</ul>
{/pc}
二级导航,可做二级下拉菜单:
{pc:content action="category" catid="0" num="" siteid="$siteid" order="listorder ASC"}
{loop $data $r}
<li><a href="{$r[url]}">{$r[catname]}</a>
{if $r[child] == 1}
{pc:content action="category" catid="$r[catid]" num="" siteid="$siteid" order="listorder ASC"}
<ul>
{loop $data $r1}
<li><a href="{$r1[url]}">{$r1[catname]}</a></li>
{/loop}
</ul>
{/pc}
{/if}
</li>
{/loop}
{/pc}
内容页栏目导航,常见于企业站左侧栏目导航:
{if $top_parentid}
{pc:content action="category" catid="$top_parentid" num="" siteid="$siteid" order="listorder ASC"}
{elseif $parentid}
{pc:content action="category" catid="$parentid" num="" siteid="$siteid" order="listorder ASC"}
{else}
{pc:content action="category" catid="$catid" num="" siteid="$siteid" order="listorder ASC"}
{/if}
{loop $data $r}
<li><a class="{if $catid==$r[catid]}nuw{/if}" href="{$r[url]}">{$r[catname]}</a></li>
{/loop}
{/pc}
附:所在栏目:
{if $top_parentid&&$top_parentid!=$catid}{$CATEGORYS[$CAT[parentid]][catname]}{else}{$CAT[catname]}{/if}