jueves, 25 de febrero de 2010

Auto generate paragraphs

By default Magnolia CMS STK comes with a mechanism to auto generate paragraphs in main and extras areas. This is very useful when you have the need of a paragraph to be present in all pages using some template. That paragraph could be modifiable or not and could be initialized with some default parameters or not.

If we have a look at the class SingletonParagraphTemplateModel, we can see that in the execute method has two method calls, one to generate a single paragraph in the main area (see stkSiteMap template) and the other one to generate any number of paragraphs in the extras area.

See below the template configuration for the main area auto generated sitemap paragraph

Nice thing is that you can extend this class or implement your own to generate any paragraph in any area of the page.

Below is the template configuration for the extras area auto generated paragraphs.