By Prakash Reddy KLV on Feb 17, 2009
In my previous post, I had demonstrated how to add content to a page in WebSpace using the Web Content Display portlet. I had used the Web Content Display portlet to add a review article about a Car. Now imagine you have a website where reviews about different cars have to be posted everyday. Creating and formatting each article using the WYSIWYG editor is definitely not scalable. It also poses some maintenance problems. Assume that you have some 100 different review articles about 100 cars on your site and your boss is not happy with the format of the content. He wants you to change the format of all the articles. Now that would require you to edit each article and modify the format using the WYSIWYG editor. Isn't that going to be tedious. And by the way 100 articles is really a small number. I have come across customers who have to maintain more than 10,000 articles on their site.
Don't worry. Here comes Structures and Templates to your rescue. Structure is meta-data for content. It defines what the content would be made of. The structure for the review article would indicate that the article is made up of a Title, Image, Author Name, Date, and Body. It is analogous to the schema of a table. Template would define how the content would be laid out on the page. For example, the template would define the Title to be bold and centered, Image to be displayed in a fixed width of 100x100, Body text to be in red color and so on. A structure can have many number of templates associated with it. Once the structure and templates are ready, you can create content corresponding to the structure by specifying values for the fields defined in the structure. This is analogous to adding a row to a table by specifying values for the columns in the table. While creating the content, you can select one of the many available templates that has to be applied while displaying the content. In this way, if you want to change the look and feel of the content, all you have to do is just assign different template to the content in place of the old one.
The following screen cast demonstrates how to apply the concept of structure and templates to create and publish review articles on to our site.
If you want to try out the above exercise, download this file exercise.txt since it contains all the content that you need to create structure, templates and web content.
For more information on the Web Content portlet, visit here.