Structures, Templates and Web Content : CMS's MVC

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.

Comments:

Great article. Hopefully we'll see those kind of tuturials more often in the coming weeks!

Posted by Dennis on February 17, 2009 at 08:31 AM IST #

Nice blog. Screencast helped a lot. Thanks.

Posted by Chaddu on February 17, 2009 at 09:42 AM IST #

@ Dennis & Chaddu

Thanks for your kind words. Sure....I will keep them coming.

-Prakash

Posted by Prakash Reddy KLV on February 17, 2009 at 11:02 AM IST #

I know this is not a support place but I will ask anyway since there is no Webspace thread at the forums: Before I start developing, I need to know how to move ALL contents from a developer system to a production system. I haven't found anything in the docs about that. Can you help me? Thanks

Posted by Dennis on February 17, 2009 at 04:16 PM IST #

Hi dennis,

There are two ways you can move your content from the developer machine to the production machine :

1. Use the staging feature : Activate staging on your developer machine. Add all the content to the staged community and once you have all the content in your staged community ready, you can publish it to the remote production machine using the "Publish to Remote" feature of staging. To know more about staging, see http://docs.sun.com/app/docs/doc/820-7054/ghywx?a=view

2. All the data in a community can be exported as a LAR file. You can then import this LAR file into the development machine. See http://docs.sun.com/app/docs/doc/820-7054/ghzkq?a=view

Hope this helps.

-Prakash

Posted by Prakash Reddy KLV on February 18, 2009 at 03:29 AM IST #

oops....In the above comment...I meant "All the data in a community can be exported as a LAR file. You can then import this LAR file into the production machine."

Posted by Prakash Reddy KLV on February 18, 2009 at 03:32 AM IST #

Hi,

again it is me: I want to report a bug: After installation exactly how it is described in the docs with linux without any error messages the appliaction crashes: Log in a Sarah Manger-MyPlaces-enterprisespace-Public Pages. After that you must restart the server.

Posted by Dennis on February 18, 2009 at 06:45 AM IST #

Hi dennis,

Please visit the following link
https://webspace.dev.java.net/servlets/ProjectMailingListList

Subscribe to the users@webspace.dev.java.net alias and post your queries to this alias.

Thanks,
Prakash

Posted by Prakash Reddy KLV on February 18, 2009 at 06:56 AM IST #

Hi,

It was a very helpful article. I am new to this. Please tell me from where do I begin the first step. I mean the home page.

Posted by Vani on February 20, 2009 at 12:16 AM IST #

Vani,

The screen cast itself begins from the home page. If you follow the steps mentioned in the screen cast and use the exercise.txt file, you will be able to implement what I have done.

Thanks,
Prakash

Posted by Prakash Reddy KLV on February 20, 2009 at 08:44 AM IST #

Thank you, this is more useful than reading the manual!

Posted by Gomer Gonzalez on February 20, 2009 at 02:48 PM IST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Prakash Reddy KLV

Search

Categories
Archives
« July 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  
       
Today