One of the core features built into Liferay Portal is the Content Management System (CMS). The CMS provides functionality in two major areas: document management (repositories for documents and images) and publishing. Document management allows you to store, index, and access all electronic documents that you have uploaded to portal. Publising provides a clean separation between your website content and the layout and presentation of that content. You will begin by adding one of your documents to the portal, and then you will learn to design a new page with web content.
Adding a Document to Document Library
Suppose you have a document on your computer right now that you want to share with others in your company or with specific members of your team.
Clich the Add Content link to bring up the Content Panel and add the Document Library portlet located under the CMS heading.
Add a new folder by clicking the Add Folder button and fill in your folder information. Keep the default permissions and click Save.
Select the document folder you just added and click on Add Document.
Use the Browse button to find the document on your local machine and give it a title and description. Click Save.
You have just uploaded a document. You can now customize security access for this document folder by clicking on the Permissons icon for your folder.
Creating and publishing content in the CMS is done through the Journal portlet. It is highly recommended that you read over the Content Management System chapter of the Users Guide to understand the various components that make up the CMS and how they work. This section will show you how to create a simple article that you can publish to a page. We will be creating three components to display our content: a structure, a template, and an article.
Structures define the type and number of content pieces (e.g. text, text area, images, selection lists, etc.)
Templates determine how content pieces will be arranged or laid out
Articles are where each content piece is populated with actual text and images
Adding a Structure
Click the Add Contentlink to bring up the Content Panel, and add the Journal portlet located under the CMS heading.
Begin by adding a structure. Click on the Structures Tab of the Journal Portlet.
Assign your article a unique ID. Fill in a name and description.
Now you will add the components that you want to use in your content. Under the XML Schema Definition section click the Add Row button twice to add two compontents. Name the first one textarea and the second one image. (You can name your components with any name you wish). Next, use the dropdown menu to select Text Area(HTML) for the first row and Image for the second row. Click Save, and you have your first Structure.
Now that you have a structure that specifies what type of components you want to work with in your article you will also need a template that specifies how these components will be arranged and styled.
Adding a Component
Select the Templates tab from the Journal portlet and click the Add button, Alternately you can also click the Add Template icon to perform the same task.
Give your template a unique ID and also add a name and description.
You will need to select the Structure you created if you did not use the Add Templates icon for that Structure.
Now you will need to input the XSL script which formats your components on the page. Click on Launch Editor to start formatting your XSL. If you don't know XSL, below are some XSL codes that will layout the two components in your structure for you. It will place your text first and then your image in the next row.
Replace what is in the editor with this code.
<?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html" omit-xml-declaration="yes"/> <xsl:template match="/"> <xsl:value-of disable-output-escaping="yes" select="root/dynamic-element[@name='textarea-1']/dynamic-content"/> <br/> <img> <xsl:attribute name="src"> <xsl:value-of disable-output-escaping="yes" select="root/dynamic-element[@name='image-1']/dynamic-content"/> </xsl:attribute> </img> </xsl:template> </xsl:stylesheet>
Click Update in the editor, and then click Save. A new Template has been created.
If you do not have text content and an image you want to add to the site you will need to find some now. We will be putting your content into an article for publishing.
Adding an Article
Select the Articles tab from the Journal portlet and click the Add button. Alternately, you can click the Add Article icon to perform the same task.
Give your Article a unique ID and add a title. You can also choose a category but we will use General in this case.
The Journal portlet allows you to specify when you would like your article to be published and when the article expires. Keep the defaults for now.
You will need to select the Template you created if you did not use the Add Article icon for that Template.
The text area is for your text content which you should add now. Note that Text Area's allow HTML as input.
Upload the image you want to display and click Save.
You now have an Article created, but it must be approved before you can use the article. Each article created in the CMS needs to be reviewed and approved by a CMS admin before it can be published. Select the article you've created in the Journal Portlet. Click the Edit button and then click Approve. Your article is now ready to be published.
Click the Add Content link to bring up the Content Panel and add the Journal Content portlet located under the heading CMS. You will see a message indicating "Please contact the administrator to setup this portlet. If you are the administrator, go to the configuration screen to setup this portlet." Disregard this message because you are the administrator. Click the Configuration icon to view a list of articles you can add to the Journal Content portlet.
Select the article you wrote and click Choose. Now go back to the main page by clicking the back icon on the portlet tool bar ( icon appears when you scroll over the toolbar).
You have just posted your first Journal Content on the Liferay Portal CMS. This was a simple example, but it provided you with a general understanding of how the CMS works. Each article can also have specific permissions set on it or be placed on the main home page or in a secure page. It's all customizable and it's up to you how you use it.