Skip to content

content

内容列表,使用方法如下:

content 标签(内容列表)
id获得id为指定值的内容(只会获得一篇内容)
flag筛选内容属性,可选值:i:首页;h:头条:c:推荐;n:最新;
cid获得指定栏目下的所有的内容
type特定用法,只用于上一篇/下一篇, 可选值为:prev|next
data特定用法,只用于搜索结果页, 值为:$rows
titlelen截取标题的长度到指定长度
例如:10,代表5个汉字或者10个字母
ellipsis指定省略符号,默认为"……"
desclen数值:截取标题的长度到指定长度
row当不需要分页时,指定取出数据条数
pagesize当需要分页时,指定每一页内容数
orderby指定通过什么排序
id:栏目ID;click_o:点击量;created_at:发布时间;updated_at:修改时间
orderway排序方式
desc:倒序;asc:正序(默认)
属性
ID{{ $_v['id'] }}
标题{{ $_v['title'] }}
短标题{{ $_v['title_s'] }}
摘要{{ $_v['desc'] }}
URL地址{{ $_v['url'] }}
缩略图{{ $_v['img'] }}
点击量{{ $_v['click_o'] }}
发布时间{{ $_v['time']['created'] }}
更新时间{{ $_v['time']['updated'] }}
时间特殊用法年: {{ date('Y', $_v['time']['created_ts']) }}
月: {{ date('m', $_v['time']['created_ts']) }}
日: {{ date('d', $_v['time']['created_ts']) }}
时: {{ date('H', $_v['time']['created_ts']) }}
分: {{ date('i', $_v['time']['created_ts']) }}
秒: {{ date('s', $_v['time']['created_ts']) }}
年-月-日:{{ date('年-月-日', $_v['time']['created_ts']) }}
年/月/日:{{ date('年/月/日', $_v['time']['created_ts']) }}
seo 标题{{ $_v['mtitle'] }}
seo 描述{{ $_v['mdesc'] }}
seo 关键字{{ $_v['mkey'] }}
额外属性
当前序号{{ $_k }}
是否第一个{{ $isFirst }}
是否最后一个{{ $isLast }}

示例

内容列表
blade
<content cid="21" row="6" flag="i" titlelen="28" timeformat="Y-m-d">
	<p>
		<a href="{{ $_v['url'] }}" target="_blank">
			{{ $_v['title'] }}<span>[{{ $_v['time']['created'] }}]</span>
		</a>
	</p>
</content>
内容头条
blade
<content row="1" flag="h"> 
    <img src="{{ $_v['img'] }}" alt="{{ $_v['title'] }}" width="205" height="125">
    <h3>{{ $_v['title'] }}</h3>
    <p>{{ $_v['desc'] }}</p>
    <a href="{{ $_v['url'] }}">[查看详情]</a>
    <p>{{ $_v['time']['created'] }}</p>
</content>
内容列表,带分页
blade
<content pagesize="8" timeformat="Y-m-d">
	<li>
		<a href="{{ $_v['url'] }}">{{ $_v['title'] }}</a>
		<span>[{{ $_v['time']['created'] }}]</span>
	</li>
</content>

<paging row="6">
	<div id="pagesinfo">
{{ $page['total'] }}条 每页{{ $page['per'] }}
		页次:{{ $page['current'] }}/{{ $page['max'] }}
	</div>
	<div id="pages">
		<ul>
			<li><a href="{{ $page['first'] }}">首页</a></li>
			<li><a href="{{ $page['prev'] }}">上一页</a></li>
			<volist name="page['pages']" id="link">
				<li class="{!! $key == $page['current'] ? 'active' : '' !!}">
					<a href="{{ $link }}"> {{ $key }} </a>
				</li>
			</volist>
			<li><a href="{{ $page['next'] }}">下一页</a></li>
			<li><a href="{{ $page['last'] }}">尾页</a></li>
		</ul>
	</div>
</paging>
栏目及栏目下的内容
blade
<category id="33">
	<div class="title">
		<a href="<span v-pre>{{ $_v['url'] }}</span>">
			<h3><span v-pre>{{ $_v['title'] }}</span></h3>
		</a>
	</div>
	<ul>
		<content cid="$_v['id']" row="4" flag="i" titlelen="16" desclen="30">
			<li>
				<a href="<span v-pre>{{ $_v['url'] }}</span>"><span v-pre>{{ $_v['title'] }}</span></a>
				<span><span v-pre>{{ date('Y-m-d', $_v['time']['created_ts']) }}</span></span>
				<div class="text"><span v-pre>{{ $_v['desc'] }}</span></div>
			</li>
		</content>
	</ul>
</category>
上一篇 下一篇
blade
<content id="$content['id']" type="prev">
	<li>上一篇<a href="<span v-pre>{{ $_v['url'] }}</span>"><span v-pre>{{ $_v['title'] }}</span></a></li>
</content>
<content id="$content['id']" type="next">
	<li>下一篇<a href="<span v-pre>{{ $_v['url'] }}</span>"><span v-pre>{{ $_v['title'] }}</span></a></li>
</content>