
Community templates
Table of Contents [-]
Version 6+ #
Use the Site Templates Portlet. It can create templates that will be available when creating new Organizations or communities. This portlet can be found in the Control Panel.
Version 5.2 #
There is a way to have site templates for communities in version 5.2. (although it is not as flexible as the portlet in version 6 and above).
This feature allows us to have 4 different templates depending on the type of the community.You may create a separate template for private, open, and protected communities. You may also create a default template that will apply if the open, private, and restricted templates are not defined.
In order to use this feature we should create communities to be our templates. The template community names must be: DEFAULT_TEMPLATE, OPEN_TEMPLATE, PRIVATE_TEMPLATE, or RESTRICTED_TEMPLATE.The template community should be a private community to avoid unauthorized access. (The templated pages are stored in the community's staging area to avoid users accidentally coming to this community.)
A newly created community will have its layouts preconfigured based on its type. If community is public, templates pages from OPEN_TEMPLATE will be used. If community is restricted, template pages from RESTRICTED_TEMPLATE will be used. If community is private, template pages from PRIVATE_TEMPLATE will be used. If any of the above templates are not found, the DEFAULT_TEMPLATE will be used. If there are no templates, then nothing is done.
This feature is programmed with a model Listener (CommunityTemplateModelListener.java) and it can be easily modified and extended using the Extension Environment to create our own listener and then registering it in the following property:
value.object.listener.com.liferay.portal.model.LayoutSet=com.liferay.portal.model.LayoutSetListener,com.liferay.portlet.communities.model.CommunityTemplateModelListener