ClassCMS

面包屑

自动自带bread函数,用来获取栏目面包屑导航.

当前栏目面包屑导航

{loop bread() as $bread}
    <a href="{$bread.link}">{$bread.channelname}</a>
{/loop}

{if !$bread.active}{/if} 可以判断是否是当前栏目

文章页面包屑导航

{loop bread() as $bread}
    <a href="{$bread.link}">{$bread.channelname}</a>
{/loop}
{if isset($title)}>{$title}{/if} {//如果有标题,则最后一项输出文章标题}

首页不需要面包屑导航,则需要代码判断

{if $.id!=$.0.id}{//如果当前栏目是首页则不需要显示面包屑代码}
    {loop bread() as $bread}
        <a href="{$bread.link}">{$bread.channelname}</a>
    {/loop}
{/if}

指定栏目面包屑导航

{loop bread(1) as $bread} {//1为栏目id}
    <a href="{$bread.link}">{$bread.channelname}</a>>
{/loop}