Cms:property
From OpenCms Wiki
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. If this is not enough, you can find a programatical solution here: Read a property of an arbitrary CmsResource
Contents |
Definition
Attributes
- name: The name of the property to read. Common properties are for example "Title", "cache", "NavText" etc.
- 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.
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" />