因微信内下载文件功能受限,手机端只提供浏览内容的基本功能,如需进行(支付、充值、下载)等操作!请到电脑端再操作!

FastAdmin导航调用标签channellist使用方法

FastAdmin导航栏(栏目列表)cms:channellist 为频道的模版标签,其可用变量及含义如下:

id:循环变量名
key:循环索引名
row:行数
limit:行数
empty:为空时显示的信息
mod:取模基数,常用于控制多少条数据后换行、变色等
cache:缓存时间,为0则不缓存,为true则永久缓存
orderby:排序字段,支持id,createtime,updatetime,rand(随机),weigh(权重)
orderway:排序方式,asc=正序,desc=倒序
imgwidth:图片宽度
imgheight:图片高度
condition:筛选条件,可使用SQL字段筛选
model:模型ID
field:调用字段,默认为*
type:指定类型,top=顶级栏目,brother=兄弟栏目,son=子栏目,sons=子孙栏目
typeid:指定类型关联的ID,如果type为空,这里可指定栏目的ID集合

具体使用方法:

<div class="rd-navbar-search_collapsable">
    <ul class="rd-navbar-nav">
        <li class="{if $Request.controller == 'index'} active{/if}"> <a href="/">首页</a> </li>
        {cms:channellist id="nav" type="top" condition="1=isnav"}
        <li class="{if $nav->is_active} active{/if}">
            <a id="{$nav.diyname}_menu" href="{$nav.url}">{$nav.name}</a>
            {if $nav.has_child}
            <ul class="rd-navbar-dropdown">
                {cms:channellist id="sub" type="son" typeid="$nav['id']" condition="1=isnav"}
                <li> <a href="{$sub.url}">{$sub.name}</a> </li>
                {/cms:channellist}
            </ul>
            {/if}
        </li>
        {/cms:channellist}
    </ul>
</div>

{if $nav->is_active} 判断当前菜单是否被选中

{if $nav.has_child} 判断是否包含子菜单

{if $Request.controller == 'index'} 判断是否为首页(这个是thinkphp5的标签可以直接用)