Page

Overview

The figure below gives a quick overview of the models available when rendering a Page using a template.

Global objects

These are the global (top level) objects available when using FreeMarker in a PageViewer, or directly from the PageEngine.

Object Description Type
page This property contains information about the page itself. PageModel
context This property contains information about the execution context. ContextModel

PageModel

This object contains information about the page.

Property Description Type(s)
resources Resources that need to be included in the final HTML-page. ResourcesModel
regions Page regions (as defined by the components, and not by the template). RegionMacro, RegionModel
clientPage Content of the clientPage, if there is a client page for this page execution. String
strings Available strings for the page. This TextMapModel supports locations “template”, “page” and “domain”. TextMapModel

ResourcesModel

This object contains information about resources that need to be included in the final HTML-page, typically page title, scripts and css-references.

The object can be used as is, producing all the relevant resources:

<head>
    ${page.resources}
</head>

Alternatively, you can generate head and body properties separately. The head-property contains references that must be in the part of the HTML-page, while the body-property contains references that may occur at the end of the part:

<html>
<head>
    ${page.resources.head}
</head>
<body>
   ...
    ${page.resources.body}
</body>
Property Description Type
head HTML for resources to generate in of HTML-page String
body HTML for resources to generate in of HTML-page String
<default> All resources at once, typically for use in of HTML-page String

RegionsModel

This model contains all the regions declared in the page. The model supports several of the basic FreeMarker model types:

In addition to exposing the properties described in the table below, the model is also a freemarker sequence containing RegionModel; these can then be accessed using the syntax page.regions[index].
The model is exposed as a sequence of RegionModel, as well
as a hash of RegionModel indexed by name, and a freemarker NodeModel which can be used for recursion.

Property Description Type
<name> A single region RegionModel
[index] A single region, by number RegionModel
?size Number of regions on page Number
?keys Sequence of region names List of String
?values Sequence of regions List of RegionModel
?children List of children nodes List of RegionModel
?parent Parent node Null
?root Root node Null
?ancestors List of ancestors List
?node_namespace There is no namespace; it always returns null. Null
?node_type Always the string “Regions” String
?node_name Always the string “Regions” String

RegionModel

This model contains all the portlets declared for a given region. The model supports several of the basic FreeMarker model types:

Property Description Type
name Name of the region itself String
html HTML for the region content String
decorated HTML for the region content, always decorated String
undecorated HTML for the region content, never decorated String
<default> HTML for the entire region String
[index] A single page component, by number PageComponentModel
?size Number of regions on page Number
?children List of children nodes List of PageComponentModel
?parent Parent node Null
?root Root node Null
?ancestors List of ancestors List
?node_namespace There is no namespace; it always returns null. Null
?node_type Always the string “Region” String
?node_name Always the string “Region” String

RegionModel is also a macro directive which can beused to print content for a region on a page, using the following syntaxes:

Using “.decorated” will return HTML-content where both the region itself and all containing portlets will be decorated with surrounding <div>-tags, while using “.undecorated” will return HTML-content where neither the region nor the containing portlets will be decorated. In general, use “.undecorated” for content rendered where the <div>-tag will be illegal, such as inside the document <head>, or when rendering non-HTML content (JSON, XML, etc).

<@page.regions region="north" />
<@page.regions region="north" container="true" />
<@page.regions region="north" container="false" />
Parameter Description Type
region Name of region that you want to print content for String
container Flag indicating whether you want to render a surrounding container or not. The default value is “true” Boolean

Specifying “container=true” for the macro makes the page engine surround every component in the region with an HTML-container( <div>...</div>). This container is required for AJAX-based operations to work, and is recommended for most content. On the other hand, for content that is not HTML-based, or for content that is to be rendered outside the of a HTML-page, the container may produce illegal output, and must be switched off.

PageComponentModel

This model contains a given page component (portlet). The model supports several of the basic FreeMarker model types:

Property Description Type
name Name of the page component itself String
markupId Markup ID for the page component String
label Printable and human readable label; often the portlet title String
<default> HTML for the entire region String
?children List of children nodes Null
?parent Parent node Null
?root Root node Null
?ancestors List of ancestors List
?node_namespace There is no namespace; it always returns null. Null
?node_type Always the string “PageComponent” String
?node_name Always the string “PageComponent” String