Liferay Web Content Display Portlet is one of the most widely used portlet to display content in the portal. To publish a basic web content in a Liferay Portal one should understand the basic features of Web Content Display Portlet. With a combination of Structure and Template we can publish rich web content. This article explain the basic features of Web Content Display Portlet along with Structure and Template.
All the UI shown here are based on Liferay 6.2
Create a basic Web Content:
Add Web Content Display portlet in any page as shown in below screen.
Once the Web Content Display Portlet is added to the page you are ready to add web content. Click on Add as shown above to add new content.
Add the title and add your content as shown in above. Then click Publish as final step.
That's all about adding a basic new web content. You can explore other options like coloring, adding hyperlink etc which are available in the editor.
A Structure is a collection of some elements like Text Box, Text, Date Field etc. Once our structure is ready then it can be associated with web content. Later we can update those Text Box, Text or Date Field with our content which will be published as a web content. Thus creating a Structure we get an interface of HTML Elements to create web content in dynamic fashion.
By defining Template we extract content from various fields as defined in Structure. In general we extract content from various fields as defined in Structure using velocity macro. After getting the content we can use those as like HTML.
In below I will demonstrate how to create Structure and Templates
You should be the Admin of the Portal. After log in, on the right top corner click on Admin--->Content. Then Web Content---> Manage--->Structure--->Add
i) Add name of the structure. Say its Sample Structure.
ii) Drag and Drop some components from left to right. Then click Save.
In the above Structure we define only two components. This means that at the time of creating new web content using this structure we will get an interface which will contains two fields to enter full name and description.
On the right side of the Structure that you have just created click on Actions--->Manage Templates.
i) Add name of the template. Say its Sample Template
ii) Now extract content from elements as defined in structure.
Keep in Mind!!
When we add template to structure we are actually associating Structure and template together. Once this association is done we can add web content to the structure. Therefore web content, structure and template are associated with each other. Remember the below sequence
i) Add Structure first
ii) Add Template to the Structure
iii) Add Web Content to the Structure
Add Content to Structure:
Now go to the web content. Click Add which will show our structure that we have created in the above. Just click on it. It will display the below screen.
The above is fully based on whatever we defined in the structure. Add all the fields and then click publish. So our content is ready which can be displayed to any page by Web Content Display Portlet.
The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.