EXCMS标签 contentlist内容列表标签
查看全部词条命名空间:Main
导航:返回上一页
EXCMS模板标签介绍,“contentlist内容列表标签”:
标签名称:contentlist
功能说明:获取内容列表
适用范围:全局使用
基本语法:{contentlist channelid= row= titlelen= infolen= imgwidth= imgheight= orderby= orderway= keyword= limit= modelid= subday= idlist= recommend= distillate= field= image= }{contentlistelse}{/contentlist}
属性说明:
名称
默认值
是否必填
描述
channelid
0
否
表示栏目ID,在栏目模板和封面模板中不需要指定,多个栏目ID可用",",默认为0,也就是相当于顶级栏目。
row
所有
否
表示返回内容列表数量。
titlelen
全部
否
表示标题显示的长度。
infolen
全部
否
表示内容描述显示的长度。
imgwidth
空
否
表示缩略图宽度。
imgheight
空
否
表示缩略图高度。
recommend
空
否
表示自定义属性值;自定义属性值可以为以下这些值:
头条[head],焦点[focus],推荐[recommend],FLASH[flash],首页头条[indexhead],滚动 [scroll],首页焦点[indexfocus],首页推荐[indexrmd]。
orderby
contentid
否
表示排序方式,默认值是 contentid' 按内容ID排列。
orderby='hot' 或 orderby='click' 或orderby='hits'表示按点击数排列
orderby='pubdate'或'publishdate' 按发布时间排列
orderby=contentid'按内容ID排序
orderby='near'
orderby='lastpost' 按评论最后回复时间排序
orderby='postnum' 按内容评论次数排序
orderby='rand' 随机获得指定条件的文档列表
orderway
desc
否
值为 desc 或 asc ,指定排序方式是降序还是顺向排序,默认为降序。
keyword
空
否
表示含有指定关键字的内容列表,多个关键字用","分开
modelid
空
否
表示特定的模型ID,内置的模型:文章(1)、图集(2)、软件(3)、Flash(4)。
limit
空
否
limit=起始,结束, 表示限定的记录范围,与row属性区别是rowf起始位置永远是从0开始的,mysql的limit语句是由0起始的,如 “limit 0,6”表示的是取前六条记录,“limit 5,6”表示由第五笔记录起,取下六条记录,使用了本属性后,row属性将无效。
subday
全部
否
表示查找在多少天以内的发布的内容,通常用于获取指定天数的热门文档、推荐文档、热门评论文档等。
idlist
空
否
表示获取指定内容ID的内容列表,内容ID之间用","隔开。
distillate
0
否
获取精华内容,参数表示指定等级,0:非精华,1:精华级别1,2:精华级别2,3:精华级别3。
field
所有字段
否
获取指定内容表中字段。
image
空
否
获取是否带有缩略图的内容。默认为全部,true带缩略图,false不带缩略图。
item
空
否
通过item属性可访问contentlist标签自身的属性,如果当前标签指定了栏目,contentlist中的item属性包含了当前栏目表的所有字段信息,否则为空,contentlist自身属性可以通过{$name.property}访问,其中"$name"是item指定的变量名称,property是指当前栏目表的字段信息。
底层模板字段:contentlist标签支持内容数据表的所有字段,如下
contentid, modelid, channelid, channelcross, title, shorttitle, metatitle, keywords, tags, description, source, author, isthumb, thumb, titleatt, likekeywords, likecontentid, forward, template, filename, ishtml, checked, userid, username, publishdate, modifieddate, createddate, distillate, recommend, credits, comment, sort, path
支持内容数据表的所有字段以外,系统提供了一些附加字段
url, encrypt_contentid, info, fulltitle, channel
例子:显示10条最新发布内容
01
02
03
04
05
06
07
08
09 {contentlist row=10}
10 {loop item=cnt}
11- {$cnt.title}
12 {/loop}
13 {/contentlist}
14
15
16
17
18
19
20
21
上例输出结果:

例2:显示最新发布的推荐内容
01
02
03
04
05
06
07 {contentlist row=10 recommend=recommend}
08 {loop item=cnt}
09- {$cnt.title}
10 {/loop}
11 {/contentlist}
12
13
14
15
16
17
上例输出结果:
