CommentList和CommentPage标签

2017-03-03 10:03 阅读

获取评论列表和评论分页。

实现类

  • com.jspxcms.core.web.directive.CommentListDirective
  • com.jspxcms.core.web.directive.CommentPageDirective

参数

  • siteId:站点ID。多个用英文逗号分隔,如'1,2,5'。默认为当前站点,如果要获取所有站点的数据,可以传空字符串''
  • fid:信息ID。
  • status:状态。默认:1(已审核)、2(推荐)。

范例

获取当前站点的评论列表:

[@CommentList limit='8';list]
  [#list list as comment]
  ${comment.creator.username}: ${comment.text!?html}
  [/#list]
[/@CommentList]

获取当前文章的评论列表(详细页有默认的info对象,可以直接使用):

[@CommentList fid=info.id limit='8';list]
  [#list list as comment]
  ${comment.creator.username}: ${comment.text!?html}
  [/#list]
[/@CommentList]

分页标签示例(Param.fid可以获取从url的参数,如/comment.jspx?fid=78,可以在模板中使用Param.fid获取值):

[@CommentPage fid=Param.fid pageSize='20';pagedList]
  [#list pagedList.content as comment]
  ${comment.creator.username}: ${comment.text!?html}
  [/#list]
  [#--包含分页模板--]
  [#include 'page.html'/]
[/@CommentPage]
咨询
交流群
电话