如何在网页内容模板中获取标题、版本、作者等信息
在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类里面进行写入的。