Skip to end of metadata
Go to start of metadata

Templates tags are an extension of html tags.

Main objective is to combine a html layout with dynamic content generated by WCM Editor.

Template tags are not part of any programming language (JSP, JSF, Groovy, or others), so, a Web Designer with html knowledge can create and modify dynamic pages without modifying/deploying portal applications.

4.2.1 Hello World template

A template is a html fragment that is rendered inside a portlet application.

Simplest template can be a Hello World template:

This template is pure static and it has not particular WCM tags, let's modify our Hello World template with some html and wcm markup:

In this example we see a standard tag for heading and three news wcm tags:

  • wcm-list tag creates a list of content iterating from a category defined in the configuration of WCM Content portlet.

In this example, the template tag will iterate over posts under category "Concert". In a template we can define several wcm-list tags linked with several categories defined in the configuration portlets. By default template links tags with category in the same order that categories are defined in configuration. We will see later how to modify this order with a specific link.

  • wcm-title tag renders post title per each post iterated inside a wcm-list tag.
  • wcm-img tag is a special tag that renders an image, this image is extracted from post body. In the example, it will extract first image found in the post. All tags combined render the following output:

This example is basic and it has not applied any style.

Like posts, we can link resources from uploads section, in the next code we are going to improve our example adding a css resource and combining with some html layout:

We can see two news wcm tags:

  • wcm-link tag allows to create a link to show a post detail inside same WCM Content portlet. This post detail view is rendered with a specific template that can be configure in the WCM Content portlet configuration:

Our last example is called "Mobile Main Template" and it is configured as Main Template in the WCM Content portlet.

In this example there is also a template called "Mobile Post Template" configured as Post Template, this one will render the post iterated through wcm-link tag in the same WCM Content portlet:

  • wcm-excerpt tag renders summary/excerpt field from post. This tag also has an attribute to limit output max length.

Now we are going to review a Post Template in our example. This template renders a post passed as parameter using previous wcm-link tag:

We can see another two new tags in the Post Template:

  • wcm-param-single tag allows to render post passed as parameter from wcm-link tag. Usual scenario is when we have defined a Post Template in a WCM Content configuration and we are rendering details of a post from a Main Template.
  • wcm-content tag renders body field of a post. In the example uses the attribute skipimages="0" to not render the first image found in the body. This feature allows to combine tags wcm-img and wcm-content to extract images from body post and to render rest of body without repeating extracted images.
gatein gatein Delete
wcm wcm Delete
templates templates Delete
tags tags Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.