Liferay, include one web content in another web content

199 views Asked by At

Let's say I have web content, which is a modal dialog. Now I want to be able to reuse this content in several other web contents. What is the easiest way to achieve this without copy modal code to each web content? JavaScript is allowed.

1

There are 1 answers

0
Olaf Kock On

Web content is a modal dialog? I don't understand the usecase, thus it's hard to give proper sample code.

If you're aware of the ID of the other webcontent that you want to use, you can retrieve this content through the API, e.g. by writing structures/templates. Templates are able to access the API and render other articles. Some of the API is hidden from templates by default, but you can revert this - look for "restricted" in portal.properties

The WCM API is named after its formal name "Journal*", check the API, e.g. JournalArticleService.