文档列表筛选标签 Filter

    筛选列表中的选项值有三部分构成。

    1. 当前栏目的子栏目
    2. 启用城市区域作为筛选项(包含城市区域子分类)2级
    3. 自定义字段作为筛选项

    调用方法

    1. <ul class="nav nav-pills">
    2. {foreach $filter as $key=>$vo }
    3. <li role="presentation" class="dropdown">
    4. <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
    5. {$vo.name} <span class="caret"></span>
    6. </a>
    7. <ul class="dropdown-menu">
    8. {foreach $vo.select as $k=>$v }
    9. <li role="presentation"><a style="margin-left:20px;text-align:left;color:{eq name='v.active' value='active'}red{/eq}" href="{$v.url}">{$v.value}</a></li>
    10. {/foreach}
    11. </ul>
    12. </li>
    13. {/foreach}
    14. </ul>

    循环内可用字段

    字段 名称 类型 说明
    name 筛选列表名称 string
    variable 筛选列表变量名称 string
    select 筛选项可用值列表 array 这是个数组列表,需要循环遍历里面的数据
    key 筛选项key string
    value 筛选项value string
    active 筛选项是否点亮 string 默认输出’active’,css样式类active
    ur 筛选项链接地址 string 地址

    数组结构

    1. Array
    2. (
    3. [0] => Array
    4. (
    5. [name] => 栏目
    6. [variable] => category
    7. [select] => Array
    8. (
    9. [0] => Array
    10. (
    11. [key] => all
    12. [value] => 全部
    13. [active] =>
    14. [url] => http://cms.shhuotuo.net/category/af/category/all
    15. )
    16. [1] => Array
    17. (
    18. [key] => 7
    19. [value] => 国际二级
    20. [active] =>
    21. [url] => http://cms.shhuotuo.net/category/af/category/7
    22. )
    23. )
    24. )
    25. [1] => Array
    26. (
    27. [name] => 多选城市
    28. [variable] => duoxuanchengshi
    29. [select] => Array
    30. (
    31. [0] => Array
    32. (
    33. [key] => all
    34. [value] => 全部
    35. [active] =>
    36. [url] => http://cms.shhuotuo.net/category/af/duoxuanchengshi/all
    37. )
    38. [1] => Array
    39. (
    40. [key] => 1
    41. [value] => 成都
    42. [active] =>
    43. [url] => http://cms.shhuotuo.net/category/af/duoxuanchengshi/1
    44. )
    45. [2] => Array
    46. (
    47. [key] => 2
    48. [value] => 德阳
    49. [active] =>
    50. [url] => http://cms.shhuotuo.net/category/af/duoxuanchengshi/2
    51. )
    52. [3] => Array
    53. (
    54. [key] => 3
    55. [value] => 绵阳
    56. [active] =>
    57. [url] => http://cms.shhuotuo.net/category/af/duoxuanchengshi/3
    58. )
    59. )
    60. )
    61. )

    输出效果 筛选器标签 Filter - 图1