The <cms:property> tag

This tag provides access to read the OpenCms properties of the current file or its parent folders as configured in the "Properties" context dialog of the OpenCms explorer view.

Attributes:

Name Description Required
name

The name of the property to read. Common properties are for example "Title", "cache", "NavText" etc.

If the selected property was not found null is returned.

yes
file

This attribute allows you to specify where to search for the property.
The following values are supported:

uri (default)
Look up the property on the file with the uri requested by the user.
search.uri or search
Look up the property by also checking all parent folders for the property, starting with the file with uri requested by the user and going "upward" if the property was not found there.
element.uri
Look up the property on the currently processed sub - element. This is useful in templates or other pages that consist of many elements.
search.element.uri
Look up the property by also checking all parent folders for the property, starting with the file with the currently processed sub - element and going "upward" if the property was not found there.
{some-file-uri}
Look up the property on that exact file uri in the OpenCms VFS, fallback if no other valid option is selected for the file attribute.
no

Body:

This tag has no body content!

Example usage:

Read the "Title" property of the current file:

<cms:property name="Title" />

... this is the same as using:

<cms:property name="Title" file="uri" />

Try to read the "locale" property of the current file, and if not found there, check all parent folders:

<cms:property name="Title" file="search" />

... this is the same as using:

<cms:property name="Title" file="search.uri" />

Read the "Title" property of the file "/index.html":

<cms:property name="Title" file="/index.html" />