Skip to content

category

栏目列表,使用方法如下:

category 标签

栏目列表,属性值可为变量
id获得栏目id为指定值的的栏目(只会获得一个栏目)
pid获得父栏目id为指定值的的所有栏目
class获得栏目class为指定值的的所有栏目
titlelen截取标题的长度到指定长度
例如:10,代表5个汉字或者10个字母
ellipsis指定省略符号,默认为"……"
desclen数值:截取标题的长度到指定长度
row指定取出数据条数
orderby指定通过什么排序
id:栏目ID;click_o:点击量;created_at:发布时间;updated_at:修改时间
orderway排序方式
desc:倒序;asc:正序(默认)
属性
ID{{ $_v['id'] }}
名称{{ $_v['title'] }}
摘要{{ $_v['desc'] }}
URL地址{{ $_v['url'] }}
类名{{ $_v['class'] }}
缩略图{{ $_v['img'] }}
banner图{{ $_v['banner'] }}
点击量{{ $_v['click_o'] }}
seo 标题{{ $_v['mtitle'] }}
seo 描述{{ $_v['mdesc'] }}
seo 关键字{{ $_v['mkey'] }}
额外属性
当前序号{{ $_k }}
是否第一个{{ $isFirst }}
是否最后一个{{ $isLast }}

示例

导航栏
blade
<li><a href="{{ indexUrl() }}" target="_self" class="menumain">首页</a></li>
<category pid="0" titlelen="8" ellipsis="">
	<li class="{!! $isLast ? 'last' : '' !!} {!! $_v['id'] == $category['top_id'] ? 'current' : '' !!}">
		<a href="{{ $_v['url'] }}">{{ $_v['title'] }}</a>
	</li>
</category>
侧导航
blade
@if (!isParent($category['top_id']))
	<category id="$category['id']">
		<li class="{!! $_v['id'] == $category['id'] ? 'hover' : '' !!}">
			<a href="{{ $_v['url'] }}"{{ $_v['title'] }}</a>
		</li>
	</category>
@else
	<category pid="$category['top_id']">
		<li class="{!! $_v['id'] == $category['id'] ? 'hover' : '' !!}">
			<a href="{{ $_v['url'] }}"{{ $_v['title'] }}</a>
		</li>
	</category>
@endif
当前栏目的顶级栏目
blade
<category id="$category['top_id']">{{$_v['title']}}</category>
列出指定的几个栏目
blade
<category id="32,37,33,39">
  <li><a href="{{ $_v['url'] }}">{{ $_v['title'] }}</a></li>
</category>