模板标签-共享栏目循环 CMS3



{list action=category module=share....}{/list} 


# 查询共享模块的所有顶级栏目
{list action=category module=share pid=0}
栏目名称{$t.name}
栏目地址{$t.url}
{/list}
# 查询共享模块的指定id为1,2,3,4的栏目
{list action=category module=share id=1,2,3,4}
栏目名称{$t.name}
栏目地址{$t.url}
{/list}
# 两级循环显示栏目(先循环父栏目,再循环其子栏目)
{list action=category module=share pid=0 return=c1}
    我是父栏目:{$c1.name}<br>
    {if $c1.child}
    {list action=category module=share pid=$c1.id return=c2}
        我是{$c1.name}的子栏目:{$c2.name}<br>
        {if $c2.child}
        {list action=category module=share pid=$c2.id return=c3}
        我是{$c2.name}的子栏目:{$c3.name}<br>
        {/list}
        {/if}
    {/list}
    {/if}
{/list}


1.参数介绍(红色表示必填参数,蓝色表示系统默认参数)

参数
介绍
action
category
module
共享栏目比较特殊,必须为module=share
site
站点id,默认当前站点,填写其他站点id表示查询其他站点的模块数据
id
栏目id,支持多个栏目以小写分号分开,例如1,2,3,4
show有show参数表示显示隐藏导航(无论show=几都有效)
pid当前id下的所有下级栏目,pid只能是一个整数,当期为0时表示顶级栏目
num
表示显示数量,只能是一个整数
letter首字母匹配的栏目
mid按模块查询栏目
more当more=1时,才显示栏目的setting内容和自定义扩展属性内容
return
默认返回变量为t,调用方式就是{$t.字段值}(多级list查询必须设置return=其他字母,否则你懂得)


2.返回变量

变量
参数
{$error}
当查询不到数据时,会返回错误信息,调试模板时很有用哦(写在list标签以外)
{$count}当前查询的记录,当存在分页时,表示当前页的记录数(写在list标签以外)
{$key}
当前记录指针位置,从0开始(写在list标签以内)
当存在return=字母时,以上变量都要写成这种格式{$变量_字母},例如{list ...reutrn=a}时,变量格式{$key_a}
{$is_first}判断是否第一条,{if $is_first}第一条{/if}
{$is_last}判断是否最后一条,{if $is_last}最后一条{/if}


签名:这个人很懒,什么也没有留下!
最新回复 (0)
返回