掲示板

Make Changes in Web Content via Velocity Template?

10年前 に Christian Freihoff によって更新されました。

Make Changes in Web Content via Velocity Template?

Junior Member 投稿: 36 参加年月日: 12/12/03 最新の投稿
To display Web Content i just write into my template

Authentification: $authentification.getData()


so it will retrieve the field named authentification that i have defined in the structure before.

No i am looking for a small tutorial or just for some tipps how i can make the shown web content editable. For example via a textfield input. What's the method to write something back to the structure defined web content field?

Thanks in advance
thumbnail
10年前 に Bart Simpson によって更新されました。

RE: Make Changes in Web Content via Velocity Template?

Liferay Master 投稿: 522 参加年月日: 11/08/29 最新の投稿
The key to update a field dynamically is to retreive the JournalArticle's content using
com.liferay.portlet.journal.model.JournalArticle.getContentByLocale
this will give the xml which contains the strucutre fields with populated data.
This xml can be modified / read using
com.liferay.portal.kernel.xml.SAXReaderUtil

From inside velocity you can access this using $saxReaderUtil
and access individual fields using something like
doc.selectSingleNode("/root/dynamic-element[@name='" + fieldName + "']/dynamic-content")
where
doc
can be retrieved from SAXReaderUtil
10年前 に Christian Freihoff によって更新されました。

RE: Make Changes in Web Content via Velocity Template?

Junior Member 投稿: 36 参加年月日: 12/12/03 最新の投稿
okay thanks,

afaik we are already using the sax reader util in java coded parts. that in can be used also in velocity, would be great.

unfortunately i am not very advanced in velocity templates for liferay, so can i find any tutorial or code example anywhere?