如何在网页内容模板中获取标题、版本、作者等信息

2016年03月29日 Liferay 暂无评论 阅读 3,632 views 次

在Liferay的网页内容模板中,我们可以方便的获取自定义的结构的字段的内容,但是有时候我们想要获取作者、标题、发布日期、版本、缩略图等信息时,却感觉找不到信息,Liferay有内置的提供,只不过很少有文档说明。

在Velocity模板中

$reserved-article-id.data
$reserved-article-version.data
$reserved-article-title.data
$reserved-article-create-date.data
$reserved-article-modified-date.data
$reserved-article-display-date.data
$reserved-article-small-image-url
$reserved-article-description
$reserved-article-asset-tag-names
$reserved-article-author-id
$reserved-article-author-name
$reserved-article-author-email-address
$reserved-article-author-comments
$reserved-article-author-organization
$reserved-article-author-location

在FreeMarker模板中

如果是在FreeMarker模板中使用如下的代码:

${.vars['reserved-article-title'].data}

其他的都类似,就不在这里一一说明。

 

这些字段是在哪里定义的?

可以在源码的JournalStructureConstants类里面找到定义,在JournalUtil类里面进行写入的。

用户头像

给我留言

您必须 登录 才能发表留言!

Copyright © IT人生录 保留所有权利.   主题设计 知更鸟 滇ICP备16001547号

用户登录

分享到: