Template management
Template management
How to bring simple templates to your contents
Section(s): front office, learning, templates
With WMS, presenting a content is done thanks to a template. Templates are always referenced to a content type.
They can handle the whole page design (category or articles templates) or a page fragment (block templates)
Read also
Implicit / Explicit templates
When designing a content object, developper can decide whether or not contributors will have the choice of a restitution template when writing a content. This is done by adding or not a template child property named template to the object structure.Content type without template property will obey the implicit template rule while content type containing a template property will obey the explicit template rule.
Creating an implicit template
Once you have created your own "foo" content object, you can create its FO template. If your new object doesn't define a template property, then it will follow the implicit template rule.
You will probably want to define the template only as the center of the page (the #element_content div). if your layout name is "bar", you will create :
/SAN/__perso/objects/foo/front/_layouts/bar/content/detail/detail_element_content.jsp
Creating an explicit template
If the foo object has a property template, you'll have to create templates for it. lets assume you created a template named "foo template" with path set to "footemplate", you will create :
/SAN/__perso/objects/foo/front/_layouts/bar/templates/footemplate/detail_element_content.jsp
The template object structure
The template object structure is a standard WEDIA WMS structure. You may not remove any of its properties, you are strongly discouraged to add properties, but most of all you must understand all of its fields and feel comfortable with filling them :
| index | name | type | nature | description |
|---|---|---|---|---|
| 8 | name | word | If your project involves contributors speaking different languages, you should fill in with a key value and translate names thanks to wcmcapion | |
| 10 | type | child | templatetype | content template / block template. |
| 11 | path | sentence | Relativepath from the current templat foler to the template main folder | |
| 12 | config | text | used for configuring target content optional fields. | |
| 13 | for | child multiple long relationel | blocktype | When creating a block template, allows to specify whor which kinds of blocks this template is available |
Developping inside the template
Once you're inside the template, several request attributes are pre-initialized for you. The most important one is activeObject. It is the active instance of the object you are viewing through the template.
<%@page pageEncoding="UTF-8"%>
<%@taglib prefix="noheto" uri="/WEB-INF/noheto.tld" %>
<%@taglib prefix="c" uri="/WEB-INF/c.tld" %>
<h1><c:out value="${activeObject.properties.name}"/></h1>
