Predefined variables in Velocity templates

thumbnail
25066, modified 19 Years ago. New Member Posts: 7 Join Date: 8/1/06 Recent Posts
Hi,

I'm using the Journal CMS with articles. Since I've used Velocity before, I'd like to use this as the template engine.

I've created a custom structure, and correctly associated it with a corresponding VM template.

But I'm unable to find in the documentation, or in the source code, the name of the predefined variables which can be accessed in the template.

To be more specific:

My custom structure has two fields: subtitle and draft(boolean) .
I can access and display them in a VM template ina straightforward manner:

$subtitle.Data
$draft.Data

but how can I access the other, standard, attributes of an article, such as the title, the date, the expiring date, and so on?

$title.Data

does not work..

Can anybody point out to me where to look for such names? Documents, source code, examplese.. anything

Thanks in advance,

Walter
thumbnail
11121, modified 19 Years ago. Liferay Master Posts: 518 Join Date: 7/20/05 Recent Posts
Interesting point. The code that stuffs all the variables into the CMS velocity template is com.liferay.portlet.journal.util.JournalVmUtil.transform(). And I believe all thoese tokens are there as well. Take a look at the variables in com.liferay.portlet.journal.model.JournalStructure. They are grabbed just before the transform occurs.
thumbnail
25066, modified 19 Years ago. New Member Posts: 7 Join Date: 8/1/06 Recent Posts
Alexander Chow:
Interesting point. The code that stuffs all the variables into the CMS velocity template is com.liferay.portlet.journal.util.JournalVmUtil.transform(). And I believe all thoese tokens are there as well. Take a look at the variables in com.liferay.portlet.journal.model.JournalStructure. They are grabbed just before the transform occurs.


Thank you, problem solved!!!

I;ve seen the classes you have pointed out. Unfortunately JournalVmUtil just seems to put in the context of the VM page the dynamic elements, i.e. the fields I' ve added to the base article.

But, despite the oddly looking names, the JournalStructure holds the names of the default attributes of the articles!!!

I've tried putting in my template the line:

$reserved-article-title.Data

and it spits out the .. article Title


I'd suggest a different naming (and a small help) should, well, help, but for the time being, it is just what I was looking for!

Again, thank you so much!
Walter