Access of content of a part which is not editable is not supported (that means the tag is created, in a page and never being edited).
1 Syntax
1.1 Node-Style
- Syntax: <node property>
- Example:
<node page.name> Is available in templates and tags (except in PartType Velocity).
1.2 VTL-Style
VTL stands for “Velocity Template Language” and stands for the syntax of “Velocity” (a template language) – see » How do I use Velocity.
- Syntax: $cms.property
- Example:
$cms.page.name Is available in PartType Velocity.
1.3 Tagmap-Style
In the tagmap is no special syntax necessary, you can use the property directly.
- Syntax: property
- Example:
page.name
Is only available in the tagmap editor in the field “tagname”.
1.4 Concatination
You can concatinate complexe properties:
<node page.folder.creator.lastname> (Node-Style) or $cms.page.folder.creator.lastname (VTL-Style)
Displays the surename of the creator of a folder in with the page is.
2 Baseobjects
These objects are almost everywhere available. These objects have various properties which can be used in a template.
Object | Ex. VTL-Style | Ex. Node-Style |
---|---|---|
page | $cms.page.name | |
template | $cms.template.id | |
file | $cms.file.name | |
folder | $cms.folder.name | |
node | $cms.node.host | |
object | $cms.object.startpage | |
rendermode | $cms.rendermode | – |
imps | $cms.imps.string | – |
tag | $cms.tag.parts.url | |
3 Context
Depending where the Template is rendered, there are different baseobjects available. For example: If a tag is rendered in a page, your (velocity)code is in the context of a page – if the same tag is used as object property, your code is in the context of objects (i.e. page, file or folder).
Context | Available base paths |
---|---|
Template | $cms.template, $cms.rendermode, $cms.imps, $cms.node |
Page | $cms.template, $cms.rendermode, $cms.imps, $cms.node, $cms.page, $cms.folder, $cms.object |
File | $cms.rendermode, $cms.imps, $cms.node, $cms.file, $cms.folder, $cms.object |
Folder | $cms.rendermode, $cms.imps, $cms.node, $cms.folder, $cms.object |
Tag | $cms.rendermode, $cms.imps, $cms.node, $cms.tag |
4 Page
The actual pageobject is only available in pagecontext (pages, pageurl’s, page overviews, pagetags)
Example: Output of date, when the page was published (e.g. 01.01.2008)
Node Style: <node page.publishdate> VTL Style: $cms.page.publishdate
Example: Rendering a whole page (e.g. to the english layout) in the page
Node Style: <node page.languageset.pages.en> VTL Style: $cms.page.languageset.pages.en
4.1 Hint
It´s important to attend not to accidentally render other pages in velocity, where it isn´t necessary, because this would influance the performance of the page (especially: overviews, navigations, …)
Example for accidentally rendering another page: On checking whether there exists an english layout of the page, and in positive case, there shall be provided a link to this layout.
Bad Performance Example:
#if("$cms.page.languageset.pages.en" != "") <a href="$cms.page.languageset.pages.en.url">English</a> #end better Example: #if($cms.page.languageset.pages.en) <a href="$cms.page.languageset.pages.en.url">English</a> #end
Property name | Description |
---|---|
id | id of the actual page |
url | adress of the actual page |
template | template of the actual page |
name | name of the actual page |
filename | filename of the actual page |
description | description of the actual page |
priority | priority of the actual page |
tags | tags of the actual page |
publishtimestamp | timestamp (that means: the time 1.1.1970 in seconds) of the publishing |
publishdate | date of publishing |
creationtimestamp | timestamp (that means: time since 1.1.1970 in seconds) of the creationdate |
creationdate | date of the pagecreation |
edittimestamp | timestamp (that means: time since 1.1.1970 in seconds) since last update of the page |
editdate | date of last page update |
folder | reference to page´s folder |
creator | reference to page´s creator |
editor | reference to last editor of the page |
publisher | reference to the last publisher of the page |
language | reference to the language of the page |
languageset.id | – |
languageset.pages | reference to other language layouts of the page |
online | true,in case page is online, else false |
ispage | returns true |
versions | version history of the page (see ‘version’ für attribute) |
version | last version of the page |
version.number | version (e.g. 3.0) |
version.date | creationdate of the page |
version.editor | editor of the version |
version.major | true, if it´s major version |
object | object properties of the page |
pagevariants | returns all page layouts (independed of the page status |
5 Template
The basic object applies to the actual template and provides the access for some properties of the template.
Example: ID Output of the actual template, only for call out of the template (e.g. 512)
Node Style: <node template.id> VTL Style: $cms.template.id
Property name | Description |
---|---|
id | id number of the template |
name | name of the template |
tags | list of all available tags of the template |
ml | markup language of the template (e.g. php3, php4, etc.) |
6 Folder
The basic object offers information about the folder.
Example: Output of the name of the folder
Node Style: <node folder.name> VTL Style: $cms.folder.name
Property name | Description |
---|---|
id | id number of the folder |
name | name of the folder |
description | description of the folder |
node | reference to node |
parent | reference to higher ranked folder or NULL |
path | path of the folder |
creator | the creator |
editor | reference to the last user, editing the page |
creationtimestamp | see also file.creationtimestamp |
creationdate | see also file.creationdate |
edittimestamp | see also file.edittimestamp |
editdate | see also file.editdate |
folders | list of all subfolders or NULL |
pages | list of references in this folder or NULL |
files | list of references of files in this folder or NULL |
images | list of images in this folder or NULL |
filesandimages | list of references of files and images in this folder or NULL |
children | list of references of subfolders, images and files |
isfolder | true |
folders | list of referendes of all subfolders of this folder or NULL |
object | object properties of this folder |
7 File
This basic object is not in context of a page, but in context of object properties and to use in tags [Basic] Overview static".
Example: Output of filename who references to file (e.g. info.txt)
Node Style: <node file.name> VTL Style: $cms.file.name
Property name | Description |
---|---|
id | id number |
name | name |
description | description |
size | size |
sizeb | size in bytes |
sizekb | size in kb |
sizemb | size in mb |
folder | reference to folder including the file |
extension | file extension |
creator | creator |
editor | reference to last editing user |
createtimestamp | timestamp (time in seconds since 1.1.1970) since the file was created |
createdate | creationdate |
edittimestamp | timestamp (time in seconds since 1.1.1970) since the file was edited last time |
editdate | last editdate |
type | type of file |
url | link to file |
width | width |
height | hight |
dpix | horitional DPI-declaretion |
dpiy | vertical DPI-declaretion |
dpi | all DPIs |
isfile | true, in case it´s a file, else false(e.g. file is an image) |
isimage | analog to isfile only for images |
object | object properties of the file |
8 Node
This basic object applies access to information of the actual node.
Example: Output of hostname of actual node (e.g. www.gentics.com)
Node Style: <node node.host> VTL Style: $cms.node.host
Property name | Description |
---|---|
id | id number of the node |
host | hostname of the node |
folder | root folder of the node |
path | path to the node |
languages | list of references of langeuages of the node |
9 Object
Applies access to the object properties of the actual object. If the object properties are not available during rendering, there exits a fallback:
Example:
$cms.object.test in this page there is a fallback to: 1.) the template ($cms.template.object.test) and 2.) the folder ($cms.folder.object.test)
10 Tag
This basic object applies access to information of a tag in a page.
Example:
Node Style: <node TAGNAME.name> Node Style: <node tag.name> VTL Style: $cms.page.tags.TAGNAME.name
Property name | Description |
---|---|
TAGNAME | references to the tag or NULL |
tag | references to the actual used tag |
id | id number of the called tag |
name | name of the called tag |
parts | list of references to a part of the tag or NULL |
parts.PARTNAME | reference to a part of the tag or NULL |
empty | 1, in case tag is empty, else 0 |
visible | 1, is case tag is active, else 0 |
istag (since GCN 5.1.3) | true |
11 Rendermode
- Only Velocity syntax
This basic object applies access to information of the actual node during rendering with velocity.
Example: Output, whether the page already was published (e.g. false)
VTL Style: $cms.rendermode.publish
Property name | Description |
---|---|
publish | true, in case page will be published in the moment |
live | true, in case using Live Preview |
edit | true,in case using the Edior Mode |
preview | true,in case using the Preview Mode |
real | true, in case using the “Real Editor” |
12 Language
Helped by this property, access of information of the language of the actual page will be provided.
Example: Output of language code of the actual page (e.g. de)
Node Style: <node page.language.code> VTL Style: $cms.page.language.code
Property name | Description |
---|---|
id | id number of the actual language |
code | code of the actual language(e.g. de) |
name | name of the actual language |
13 Pagetag/Templatetag Parttype
This object provides detailed information about tags. Pagetags for connecting Node Tags out of other pages. Templatetags for connecting Node Tags out of other templates.
Property name | Description |
---|---|
id | id number |
tag | reference to the tag |
container | page or template the tag is referencing to |
14 Markuplanguage
This object applies the access to the markuplanguage out of a template.
Example: Output of the name of the markuplanguage (e.g. php4)
Node Style: <node page.template.ml.name> VTL Style: $cms.page.template.ml.name
Property name | Description |
---|---|
id | id number of the markuplanguage |
extension | fileextension |
name | name |
contenttype | character of the content |
15 User
This object applies access to a user.
Example: Output of the name of the creator
Node Style: <node page.creator.lastname> VTL Style: $cms.page.creator.lastname
Property name | Description |
---|---|
id | id number of the user |
firstname | prename of the user |
lastname | lastname of the user |
login | login name of the user |
mail adress of the user | |
active | true, in case user is active now |
creator | creator of the user |
creationdate | date of the creation of the user |
creationtimestamp | timestamp (time in secondes since 1.1.1970) of the creation of the user |
editor | editor of the user |
editdate | date where the user was edited last time |
edittimestamp | timestamp (time in secondes since 1.1.1970) where the user was edited last time |
description | description of the user |
15.1 Overview Template
Special syntax
Property name | Description |
---|---|
<node ds.nr> | number of overviewcolums/repetitions |
<node ds.count> | number of pages, returned by an overview |
<node ds.container> | page, where the overview was inserted |
16 Imps
This basic object applies access to information of helpobjects during rendering with velocity.
String Imp Example:
VTL Style: $cms.imps.string
Velocity GenericTools contains a collection of reusable and well documented tools and utility classes of general interest to Velocity users. These classes and tools have no dependency on the VelocityView or VelocityStruts sub-projects. The tools may be used as you would any other POJO (“plain old java object”).
Property name | Description |
---|---|
velocitytools | Velocity ToolsImp |
velocitytools.date | DateTool |
velocitytools.math | MathTool |
velocitytools.number | NumberTool |
velocitytools.esc | EscapeTool |
velocitytools.alternator | AlternatorTool |
velocitytools.list | ListTool |
velocitytools.iterator | IteratorTool |
string | String Formatter |
sorter | SortImp |
date | Date Formatter see PN3 reference index term “Imps” for additional information and examples |
loader | The LoaderImp can be used to retrieve content objects by id (since build 20090110) It supports the following methods to retrieve objects (they return the same objects which are available under $cms.page, $cms.file, etc.) getObject(type, id): Returns the content object of the given type with the given id. type can be one of: “page”, “folder”, “image”, “file”, “node”. getPage(id) getFolder(id) getImage(id) getFile(id) getNode(id) |
url | The URLIncludeImp can be used to include contents fetched from a given URL into the rendered page. |
Example:
$cms.imps.url.include(url, cache, timeout, default)
url | URL to be requested |
cache | cache lifetime in secs, defaults to 300 secs (5 mins) |
timeout | timeout for accessing the URL and getting the contents in ms, defaults to 2000 ms (2 secs) |
default | default content to be returned, if the URL cannot be accessed (default: null, will result in an error if URL cannot be accessed) |
17 Parttypes
17.1 Overview Parttype (Only Velocity syntax)
Example starting from a page:
#foreach( $item in $cms.page.tags.overview_tag.partkeyword.items ) $item.key - $item.value #end
Property name | Description |
---|---|
items | Collection, viewable objects of the overview |
17.2 Datasource/Select (Single)/Select (Multiple) Parttype
Property name | Description |
---|---|
values | values of the database |
keys | name of the dataset in the database |
value | value of the actual dataset |
key | name of the actual dataset |
dsid | intern id of the element |
17.3 Datasource/Select (Single)/Select (Multiple) Parttype (Only Velocity syntax)
Example:
// ## [partname] must be changed of the tagpart #foreach( $item in $cms.tag.parts.[partname].items ) $item.key - $item.value #end
Property name | Description |
---|---|
items | Collection of all entries in the database |
selection | Collection of all seleced entries in the database |
key | name of the entry |
value | value of the entry |
nr | clear id of the entry |
dsid | intern id of the element |
17.4 Datasource/Select (Single)/Select (Multiple) Template
Special syntax
Property name | Description |
---|---|
<ds value> | the selected value |
<ds name> | name of the selected value |
<ds nr> | clear id of the value |
<ds dsid> | intern id of the element |
17.5 Pageurl Parttype
Example: Output of the id of the url parttype
Node-Style: <node page.tags.tlink1.href.id> VTL-Style: $cms.page.tags.tlink1.href.id
Property name | Description |
---|---|
internal | boolean, link in intern or extern |
target | return pageobject, in case target is intern, else NULL |
url | Output of the URL of the page, if the target is intern, else NULL |
id | returns id of the parttype |
17.6 Fileurl Parttype
Property name | Description |
---|---|
target |
17.7 Checkbox Parttype
This property belongs to a checkbox and is only available in this context.
Property name | Description |
---|---|
checked | true, in case checkbox was checked, else false |
TEXT PARTTYPE | This property is available in the following tags: Text, Text/Html, HTML, Text Short, Text Html Long, HTML lang, Java und DHTML |
text | returns the content of the tags |
18 Pitfalls
If a TagType/Tag contains a part called ‘class’ (e.g. for css) the path $cms.tag.parts.class cannot be used to retrieve its value because it would return the Java class of the according Tagtype. Instead the fallback $cms.tag.parts.getProperty(“class”) must be used.