This blog post explains how you can speed up the development of creating pages in Alfresco Share by using a couple of 'out of the box templates'.
The idea is that when creating a 'simple' page in Share with 1, 2 or 3 column you shouldn't have create your own template-instance.xml and template.ftl file. Instead you can re-use one of the 6 out of the box templates described below. That means that you only need to define 1 page.xml-definition in which you tell which webscripts to display inside each region.
The out of the box templates described below are using 'page scoped' regions which means that they can be configured from within a page.xml file. They also make use of a new Spring Surf feature that makes it possible to associate multiple webscripts to a single template region, a feature that was made available in Alfresco Community 4.0.a release.
Note! The actual out of the box templates were made available on HEAD in revision 31068. - They are thereby NOT included in the 4.0a release, so to use them you need to either download the Alfresco Community 4.0.b release OR (to use them in Alfresco Community 4.0.a) do the following...
Place it in your <SHARE_TOMCAT_HOME>/shared/classes directory
Restart your server
Now we will take a look at how the new templates look and then give an example of how to use them.
Below you can see the 6 templates in action. I have created sample pages using them to make it easy for you to understand the structure of each template.
I am using the components/title/simple-title.get webscript to display the blue title (i.e. 'TEST 1 COLUMN') and a custom webscript created for this blog post (components/test/echo.get available in the source code for this blog post) to display the 'Echo strings' (i.e. 'Echo: FIRST').
First note that we use the <template-instance> element to define that the 1-column template shall be used.
Then note that the syntax used to 'bind in' the webscripts into a region are different in the two regions.
In the 'title' region we only need one webscript and therefor we use the same old syntax that has been used in Share since day 1.
In the 'column' region, however, we want to add in multiple webscripts into the same region. We therefore have to use the new <sub-components>-syntax to get the job done (available since the Alfresco Share Community 4.0a release). Using this syntax means that you can add in as many webscripts as you like in 1 region. Note! Make sure you make the 'id' attribute in the <sub-component> element 'unique per region'.