[基础用法]
标签:screening
描述:筛选文章
用法:
{eyou:screening id='field' currentclass='active' alltxt='不限' }
<div class="row">
<div class="filter-box">
<!-- 筛选项栏目循环 -->
{eyou:volist name='$field.list' id='vo'}
<div class="filter-boxs">
<!-- 筛选项标题 -->
<div class="filter-tit">
{$vo.title} :
</div>
<!-- 筛选的可选值循环 -->
<div class="filter-cen">
{eyou:volist name='$vo.dfvalue' id='val'}
<a {$val.onClick} class="{$val.currentclass}">{$val.name}</a>
{/eyou:volist}
</div>
<!-- 筛选的可选值循环结束 -->
</div>
{/eyou:volist}
<!-- 筛选项栏目循环结束 -->
<!-- 清除所有筛选条件按钮 -->
<div class="filter-bt"><a href="{$field.resetUrl}">清除筛选条件</a></div>
</div>
<!-- 隐藏域 -->
{$field.hidden}
</div>
{/eyou:screening}
属性:
id='' 可以任意指定循环里的变量名替代field,假设id='field1',模板调用如:{$field.title} 变成 {$field1.title}
typeid='' 专用于首页筛选,首页调用标签一定要指定栏目ID
currentclass='' 应用样式class类名
addfields='' 自定义字段名,多个字段之间用英文逗号隔开,比如:addfields='price,spce'
alltxt='' 筛选数值中的第一个自定义选项,该选项是用于重置单条筛选条件,alltxt='off' 表示不显示,其他文案显示比如:alltxt='全部',alltxt='不限',alltxt='所有'
empty='' 没有数据时显示的文案
涉及表字段:
请查阅
易优cms官方提供的数据字典,找到表名 ey_channelfield 、ey_article_content
-------------------------------效果展示--------------------------------
1,调用指定栏目文章
模板调用标准代码
{eyou:screening id='field' currentclass='active' alltxt='全部'}
<div class="row">
<div class="filter-box">
{eyou:volist name='$field.list' id='vo'}
<div class="filter-boxs">
<div class="filter-tit">
{$vo.title} :
</div>
<div class="filter-cen">
{eyou:volist name='$vo.dfvalue' id='val'}
<a {$val.onClick} class="{$val.currentclass}">{$val.name}</a>
{/eyou:volist}
</div>
</div>
{/eyou:volist}
<div class="filter-bt"><a href="{$field.resetUrl}">清除筛选条件</a></div>
</div>
{$field.hidden}
</div>
{/eyou:screening}
网站前端显示效果(css样式请自行填充)
【更多示例】
-------------------------------示例1--------------------------------
描述:指定自定义字段读取筛选条件
{eyou:screening id='field' currentclass='active' addfields='danxuan' alltxt='不限'}
<div class="row">
<div class="filter-box">
{eyou:volist name='$field.list' id='vo'}
<div class="filter-boxs">
<div class="filter-tit">
{$vo.title} :
</div>
<div class="filter-cen">
{eyou:volist name='$vo.dfvalue' id='val'}
<a {$val.onClick} class="{$val.currentclass}">{$val.name}</a>
{/eyou:volist}
</div>
</div>
{/eyou:volist}
<div class="filter-bt"><a href="{$field.resetUrl}">清除筛选条件</a></div>
</div>
{$field.hidden}
</div>
{/eyou:screening}
-------------------------------示例2--------------------------------
描述:关闭 “不限” 筛选按钮
{eyou:screening id='field' currentclass='active' alltxt='off'}
<div class="row">
<div class="filter-box">
{eyou:volist name='$field.list' id='vo'}
<div class="filter-boxs">
<div class="filter-tit">
{$vo.title} :
</div>
<div class="filter-cen">
{eyou:volist name='$vo.dfvalue' id='val'}
<a {$val.onClick} class="{$val.currentclass}">{$val.name}</a>
{/eyou:volist}
</div>
</div>
{/eyou:volist}
<div class="filter-bt"><a href="{$field.resetUrl}">清除筛选条件</a></div>
</div>
{$field.hidden}
</div>
{/eyou:screening}
-------------------------------示例3--------------------------------
描述:三级区域联动筛选
{eyou:screening id='field' currentstyle='active' }
{eyou:volist name='$field.list' id='vo'}
<dl class="clearfix">
<dt class="text-main">{$vo.title}:</dt>
<dd>
<div class="filter-nav">
<ul>
{eyou:volist name='$vo.dfvalue' id='val'}
<li><a {$val.onClick} class="radius-rounded {$val.currentstyle}">{$val.name}</a></li>
{/eyou:volist}
</ul>
</div>
</dd>
</dl>
<!-- 二级输出标签,未选择一级时隐藏 -->
{eyou:volist name='$vo.dfvalue' id='val'}
{notempty name="$val.twoLevelArr"}
<dl class="clearfix">
<dt class="text-main">城市:</dt>
<dd>
<div class="filter-nav">
<ul>
{eyou:volist name='$val.twoLevelArr' id='two'}
<li><a {$two.onClick} class="radius-rounded {$two.currentstyle}">{$two.name}</a></li>
{/eyou:volist}
</ul>
</div>
</dd>
</dl>
<!-- 三级输出标签,未选择一级时隐藏 -->
{eyou:volist name='$val.twoLevelArr' id='two'}
{notempty name="$two.threeLevelArr"}
<dl class="clearfix">
<dt class="text-main">区县:</dt>
<dd>
<div class="filter-nav">
<ul>
{eyou:volist name='$two.threeLevelArr' id='three'}
<li><a {$three.onClick} class="radius-rounded {$three.currentstyle}">{$three.name}</a></li>
{/eyou:volist}
</ul>
</div>
</dd>
</dl>
未经允许不得转载:Str Tom工作室 » screening 筛选标签