模板手册

模板指令(标签)

<@cms_content>

<@cms_content>

内容列表标签

标签名

<@cms_content>

标签描述

获取内容数据列表,内嵌<#list DataList as content>${content.name}</#list>遍历数据

标签属性

属性名类型必填可用值描述默认值
pageBOOLEANtrue=是
false=否
是否分页获取数据false
sizeINTEGER分页数据条数,默认:20
conditionSTRING扩展sql条件语句,例如:title like 'a%'
catalogidINTEGER栏目ID
catalogaliasSTRING栏目别名
levelSTRINGRoot=所有栏目
Current=当前栏目
Child=子栏目
CurrentAndChild=当前栏目及子栏目
数据获取范围,值为Root时忽略属性catalogidcatalogaliasCurrent
sortSTRINGRecent=发布时间降序
Views=浏览量降序
Default=排序字段降序(默认)
排序方式Default
hasattributeSTRING包含内容属性,多个属性英文逗号分隔
noattributeSTRING不包含内容属性,多个属性英文逗号分隔
statusSTRING状态,'-1'表示不限制状态30: 已发布
topflagBOOLEANtrue=是
false=否
是否允许置顶true

标签数据属性

属性名描述类型
attributes内容属性标识列表String[]
author作者String
catalogAncestors所属栏目祖级IDsString
catalogId所属栏目IDLong
commentCount评论数(非实时)Long
contentId内容IDLong
contentType内容类型String
contributorId投稿用户IDLong
createBy创建者String
createTime创建时间LocalDateTime
deptCode所属部门编码String
deptId所属部门IDLong
editor编辑String
favoriteCount收藏数(非实时)Long
images封面图列表List<String>
keywords关键词String[]
likeCount点赞数(非实时)Long
link内容链接String
linkFlag是否链接内容String
logo封面图String
logoSrc封面图访问路径String
original是否原创String
prop1备用字段1String
prop2备用字段2String
prop3备用字段3String
prop4备用字段4String
publishDate发布时间LocalDateTime
redirectUrl跳转链接(linkFlag==Y)String
remark备注String
seoDescriptionSEO描述String
seoKeywordsSEO关键词String
seoTitleSEO标题String
shortTitle短标题String
siteId所属站点IDLong
sortFlag排序值Long
source来源String
sourceUrl来源URLString
subTitle副标题String
summary摘要String
tagsTAGsString[]
title标题String
titleStyle标题样式String
topCatalog所属顶级栏目Long
topDate置顶结束时间LocalDateTime
topFlag置顶标识Long
updateBy更新者String
updateTime更新时间LocalDateTime
viewCount文章浏览数(非实时)Long

用法示例

示例1

使用场景:栏目列表页展示内容列表

<@cms_content catalogid="${Catalog.catalogId}" level="CurrentAndChild" sort="Recent" page="true" size="16">
<#list DataList as content>
  <#if (content.logo!'')!=''>
  <img src="imageSize(content.logo,200,200)" />
  </#if>
  <a href="${content.link}" target="_blank">${content.title}</a>
</#list>
</@cms_content>

示例2

使用场景:推荐/热点内容列表,使用hasattribute过滤内容属性,hot=热点,recommend=推荐,其他属性参考数据字典配置[cms_content_attribute]

<@cms_content catalogid="${Catalog.catalogId}" level="CurrentAndChild" hasattribute="recommend" sort="Recent" page="true" size="16">
<#list DataList as content>
  <#if (content.logo!'')!=''>
  <img src="imageSize(content.logo,200,200)" />
  </#if>
  <a href="${content.link}" target="_blank">${content.title}</a>
</#list>
</@cms_content>