类 CmsContentListDirective
java.lang.Object
com.publiccms.common.directive.BaseTemplateDirective
com.publiccms.common.base.AbstractTemplateDirective
com.publiccms.views.directive.cms.CmsContentListDirective
- 所有已实现的接口:
Directive,HttpDirective,freemarker.template.TemplateDirectiveModel,freemarker.template.TemplateModel
contentList 内容列表查询指令
上下文变量
lang:语言
参数列表
categoryId:分类id,当parentId为空时有效containChild:是否包含子分类,【true,false】categoryIds:多个分类id,当categoryId为空时有效modelId:多个模型idparentId:父内容idonlyUrl:外链,【true,false】hasImages:拥有图片列表,【true,false】hasFiles:拥有附件列表,【true,false】hasProducts:拥有产品列表,【true,false】hasCover:拥有封面图,【true,false】userId:发布用户idstartPublishDate:起始发布日期,【2020-01-01 23:59:59】,【2020-01-01】endPublishDate:终止发布日期,高级选项禁用时不能超过现在,【2020-01-01 23:59:59】,【2020-01-01】advanced:开启高级选项, 默认为falsestatus:高级选项:内容状态,【0:操作,1:已发布,2:待审核,3:驳回】disabled:高级选项:禁用状态,默认为falseemptyParent:高级选项:父内容id是否为空,【true,false】,当parentId为空时有效title:高级选项:标题absoluteURL:url处理为绝对路径 默认为trueabsoluteId:id处理为引用内容的ID 默认为truecontainsAttribute默认为false,http请求时为高级选项,为true时content.attribute为内容扩展数据map(字段编码,value)orderField排序字段,【score:评分,comments:评论数,clicks:点击数,collections收藏数,publishDate:发布日期,updateDate:更新日期,checkDate:审核日期】,默认置顶级别倒序、发布日期按orderType排序orderType:排序类型,【asc:正序,desc:倒序】,默认为倒序firstResult:开始位置,从1开始pageIndex:页码,firstResult不存在时有效pageSize:每页条数maxResults:最大结果数
返回结果
page:PageHandlerpage.list:List类型 查询结果实体列表CmsContent
<#assign lang="cn"/> <@cms.contentList pageSize=10><#list page.list as a>${a.title}<#sep>,</#list></@cms.contentList>
<script>
fetch('${site.dynamicPath}api/directive/cms/contentList?pageSize=10',{"headers":{"lang":"cn"}}).then(res => res.json()).then(data=>{
console.log(data.page.totalCount);
});
</script>
-
字段概要
字段修饰符和类型字段说明private CmsContentAttributeServiceprotected ContentConfigComponentprotected FileUploadComponentprivate CmsContentLangServiceprivate CmsContentServiceprotected SiteAttributeComponentprivate StatisticsComponent从类继承的字段 com.publiccms.common.base.AbstractTemplateDirective
ADVANCED, APP_TOKEN, AUTH_TOKEN, AUTH_USER_ID, siteComponent从类继承的字段 com.publiccms.common.directive.BaseTemplateDirective
log从接口继承的字段 freemarker.template.TemplateModel
NOTHING -
构造器概要
构造器 -
方法概要
从类继承的方法 com.publiccms.common.base.AbstractTemplateDirective
execute, expose, getAdvanced, getApp, getSite, getUser, getUserId, needAppToken, needUserToken从类继承的方法 com.publiccms.common.directive.BaseTemplateDirective
execute, getName, getNamespace, getShortName, httpEnabled, setName, setNamespace, setShortName
-
字段详细资料
-
contentConfigComponent
-
attributeService
-
fileUploadComponent
-
statisticsComponent
-
siteAttributeComponent
-
service
-
langService
-
-
构造器详细资料
-
CmsContentListDirective
public CmsContentListDirective()
-
-
方法详细资料
-
execute
public void execute(RenderHandler handler) throws IOException, freemarker.template.TemplateException - 参数:
handler-- 抛出:
IOExceptionfreemarker.template.TemplateException
-
supportAdvanced
public boolean supportAdvanced()- 覆盖:
supportAdvanced在类中AbstractTemplateDirective- 返回:
- support advanced parameters
-