Foren
Make Changes in Web Content via Velocity Template?
Christian Freihoff, geändert vor 10 Jahren.
Make Changes in Web Content via Velocity Template?
Junior Member Beiträge: 36 Beitrittsdatum: 03.12.12 Neueste Beiträge
To display Web Content i just write into my template
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
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
Bart Simpson, geändert vor 10 Jahren.
RE: Make Changes in Web Content via Velocity Template?
Liferay Master Beiträge: 522 Beitrittsdatum: 29.08.11 Neueste Beiträge
The key to update a field dynamically is to retreive the JournalArticle's content using
This xml can be modified / read using
From inside velocity you can access this using $saxReaderUtil
and access individual fields using something like
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
Christian Freihoff, geändert vor 10 Jahren.
RE: Make Changes in Web Content via Velocity Template?
Junior Member Beiträge: 36 Beitrittsdatum: 03.12.12 Neueste Beiträge
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?
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?