👩💻内容
- 遍历所有内容
<@_contentList categoryId=id pageIndex=pageIndex pageSize=category.pageSize > <#list page.list as a> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="margin-top: 60px;"> <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12" data-scroll-reveal="enter bottom move 20px over 1.5s after 0.05s"> <img src="${a.cover!}" alt="" style="width: 100%;"> </div> <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12" data-scroll-reveal="enter bottom move 20px over 1.5s after 0.05s"> <div class="zxlj1"> <span>${a.publishDate?string('yyyy/MM/dd')}</span> <p style="font-size: 16px;"><b><a href="${a.url!}">${a.title!}</a></b></p> <p class="zxlj2">${a.description!}</p> <div class="zxlj3"> <a href="">了解更多</a> <img src="${site.sitePath}lifeteam/images/113922.png" alt=""> </div> </div> </div> </div> </#list> </div> </div> </div> <div class="index_section sec02" style="margin-bottom: 40px;"> <div class="container"> <div class="row zxl99"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 text-center" data-scroll-reveal="enter bottom move 20px over 1.5s after 0.05s"> <div class="zxlb8"> <ul> <li><a href="?id=${id!}">首页</a></li> <li ><a href="?id=${id}&&pageIndex=${page.prePage}"><<</a></li> <b>${page.pageIndex}<span>/</span>${page.totalPage}</b> <li><a href="?id=${id}&&pageIndex=${page.nextPage}">>></a></li> <li><a href="?id=${id}&&pageIndex=${page.totalPage}">尾页</a></li> </ul> </div> </div> </div> </div> </div> </@_contentList>
说明:
- 如果此页面需要接收参数的话,一定要在元数据的页面加上需要接收的参数 。(此处我写的两个 ,分别为
id
和pageSize
)
- 判断父分类是否为空:
<#if category.parentId??>
- 获取内容标题:
a.title
- 发表用户:
userId
- 分类编号:
categoryId
- 父内容编号:
parentId
- 作者:author
- 是否拥有图片列表:
hasImages
- 是否拥有附件列表:
hasFiles
- 地址:
url
- 描述:
description
- 封面:
cover
- 子内容数:
childs
- 发表日期:
publishDate
- 创建日期:
createDate
- 状态:
status
,0:草稿 1:已发布 2:待审核
- 内容遍历的时候,
list
里面可加的参数以及说明:代码示例:
<@_contentList categoryId=categoryId containChild=containChild modelId=modelId parentId=parentId onlyUrl=onlyUrl hasImages=hasImages hasFiles=hasFiles hasCover=hasCover orderField=orderField orderType=orderType pageIndex=pageIndex pageSize=pageSize> <#list page.list as a> <a href="${a.url!}">${a.title}</a> </#list> </@_contentList>
- 参数说明:
categoryId
:分类IDcontainChild
:包含子分类内容categoryIds
:多个分类IDmodelId
:模型IDparentId
:父内容IDonlyUrl
:外链["true
":是,"false
":否]hasImages
:拥有图片列表["true
":是,"false
":否]hasFiles
:拥有附件列表["true
":是,"false
":否]hasCover
:拥有封面图["true
":是,"false
":否]orderField
:排序字段["scores
":分数,"comments
":评论,"clicks
":点击数,"publishDate
":发布日期,"checkDate
":审核日期,"updateDate
":更新日期,默认:排序、发布日期字段倒序]orderType
:排序类型["asc
":正序,"desc
":倒序]pageIndex
:页码pageSize
:每页数据条数
<link href="${site.sitePath}lifeteam/css/bootstrap.css" rel="stylesheet">
<script src="${site.sitePath}lifeteam/js/jquery-1.3.2.min.js"></script>
<img src="${site.sitePath}lifeteam/images/093707.png">
- 其他站点管管配置:
- 站点名称:
${site.name!}
- 站点LOGO:
${siteAttribute.logo!}
- 站点方形LOGO:
${siteAttribute.square_logo!}
- 打印数据模型变量:
<#list .dataModel?keys as k>${k}<#sep>,</#list>
- 打印当前命名空间数据模型:
<#list .namespace?keys as k>${k}<#sep>,</#list>
- 3.遍历多个标签
<@_tag ids=ids> <#list map as k,tag>${tag.name}<#sep>,</#list> </@_tag>
- 4.搜索页面:
<@_search word=word tagId=tagId highlight=true dictionaryValues=dictionaryValues categoryId=categoryId containChild=containChild categoryIds=categoryIds modelIds=modelIds startPublishDate=startPublishDate pageIndex=pageIndex pageSize=pageSize> <#list page.list as a> <a href="${a.url!}">${a.title?no_esc}</a> </#list> </@_search>
- 参数说明:
word
:搜索词tagId
:标签IDdictionaryValues
:非全文搜索类型扩展字段(值:[字段编码]_[字段值])categoryId
:分类IDcontainChild
:包含子分类内容categoryIds
:多个分类IDmodelIds
:多个模型IDstartPublishDate
:开始日期orderField
:排序字段["publishDate
":发布日期逆序]pageIndex
:页码pageSize
:每页数据条数
categoryIds
:多个分类ID
- modelIds
:多个模型ID
- startPublishDate
:开始日期
- orderField
:排序字段["publishDate
":发布日期逆序]
- pageIndex
:页码
- pageSize
:每页数据条数
📌今天的分享就到这里了啦,欢迎一键三连~关注微信公众号:雄雄的小课堂。