Tag library reference for the following tag libraries:
Core functions for CMS
Namespace definition: xmlns:cmsfn="http://www.magnolia.info/tlds/cmsfn-taglib.tld"
EL Functions
Required attributes are marked with a*
Function class: info.magnolia.cms.taglibs.CmsFunctions
Function signature: boolean canEdit()
Check if the current user can edit the active page
Function class: info.magnolia.cms.taglibs.CmsFunctions
Function signature: info.magnolia.cms.core.Content currentPage()
Returns the current active page (can be set using the loadPage tag).
Function class: info.magnolia.cms.taglibs.CmsFunctions
Function signature: info.magnolia.cms.core.Content currentParagraph()
Returns the current paragraph.
Function class: info.magnolia.cms.taglibs.CmsFunctions
Function signature: boolean isEditMode()
Check if the current page is open in editing mode. Shortcut for checking if the server is admin, preview unset, permissions to modify the page available for the current user.
Function class: info.magnolia.cms.taglibs.CmsFunctions
Function signature: boolean firstPageWithCollection(java.lang.String,int)
Find and load the first parent page containing named collection of nodes. This function can be useful while building pages that should inherit columns from parent pages. Loaded page must be unloaded using the <cms:unloadPage /> tag. Sample use: <pre> <c:if test="${cmsfn:firstPageWithCollection("column", 3)}"> content inherited from page ${cmsfn:currentPage().handle}.html <cms:contentNodeIterator contentNodeCollectionName="column"> <cms:includeTemplate /> </cms:contentNodeIterator> <cms:unloadPage /> </c:if> </pre>
Function class: info.magnolia.cms.taglibs.CmsFunctions
Function signature: boolean firstPageWithNode(java.lang.String,int)
Find and load the first parent page containing a named node. This function can be useful while building pages that should inherit a paragraph from parent pages. Loaded page must be unloaded using the <cms:unloadPage /> tag. Sample use: <pre> <c:if test="${cmsfn:firstPageWithNode("node", 3)}"> content inherited from page ${cmsfn:currentPage().handle}.html <<cms:includeTemplate contentNodeName="node" /> <cms:unloadPage /> </c:if> </pre>
Function class: info.magnolia.cms.util.SelectorUtil
Function signature: java.lang.String getSelector()
Function class: info.magnolia.cms.taglibs.CmsFunctions
Function signature: boolean isLoggedIn()
Check if a user is currently logged in (not anonymous)
Function class: info.magnolia.cms.taglibs.CmsFunctions
Function signature: java.lang.String link(java.lang.String)
Output the url of a given content (usually a page), as context path + page handle + default extension
Function class: info.magnolia.cms.taglibs.CmsFunctions
Function signature: info.magnolia.cms.core.Content mainPage()
Returns the main loaded page (doesn't change when using the loadPage tag).
Function class: info.magnolia.cms.taglibs.CmsFunctions
Function signature: java.util.Collection nodeDataIterator(info.magnolia.cms.core.Content, java.lang.String)
Function to iterate over a node Data that has "checkbox" as control type, for example. See http://jira.magnolia-cms.com/browse/MAGNOLIA-1969
Function class: info.magnolia.cms.taglibs.CmsFunctions
Function signature: java.util.Properties systemProperties()
Returns the system properties
Core tag library for CMS
Namespace definition: xmlns:cms="cms-taglib"
Tags
Required attributes are marked with a*
Everything between adminOnly tags will only be shown on an authoring instance, not on a public instance. This allows you to provide functionality that is only available to page authors but not to the general public.
Can contain:JSP
Adds a button to a parent bar. Must be nested into a mainBar or newBar to work.
Can contain:empty
Iterate over contentNode collection. contentNodeIterator is used whenever you want to loop over content, typically paragraphs. A parameter contentNodeCollectionName will contain the name of the contentNode you are looping over. contentNodeCollectionName is created by providing a newBar with the corresponding name. This will result in elements being created within that contentNode, and thus allow you to loop over these.
Can contain:JSP
<pre> <cms:contentNodeIterator contentNodeCollectionName="mainColumnParagraphs"> <cms:adminOnly> <cms:editBar/> </cms:adminOnly> <cms:includeTemplate/> </cms:contentNodeIterator> </pre>
Name | Description | Type |
---|---|---|
begin | Zero-based index of first item to process, inclusive. | int |
contentNode | The content object to use. | String |
contentNodeCollectionName | Name of the collection holding the content node, e.g. "mainColumnParagraphs". | String |
contentNodeName | Inside a "contentNodeIterator": if not set, the current content node is taken. If set empty (contentNodeName=""), the top level content is taken. If specified, the named content node is taken. Outside a "contentNodeIterator": if not set or empty: the top level content is taken. If specified, the named content node is taken. | String |
end | Zero-based index of last item to process, inclusive. | int |
inherit | Inherit the value from parent pages, if not set in the current one. | boolean |
items | if this attribute is set, the tag will iterate on the collection directly passed here instead of fetching the collection named by contentNodeCollectionName. This collection must contains info.magnolia.cms.core.Content items. | java.util.Collection |
nodeDataName | nodeDataName is not supported in this tag ! | String |
path | The absolute path to the content. You must define the repository attribute if the content is not stored in the website repository. | String |
repository | Used if the uuid or path attribute is set. Defaults to "website". | String |
step | Process every stepth element (e.g 2 = every second element). | int |
uuid | The uuid to use for finding the content. You must define the repository attribute if the content is not stored in the website repository. | String |
varStatus | Name of variable to hold the loop status with the following properties: index: position of the current item; count: number of times through the loop (starting with 1); first: boolean indicator if this is the first iteration; last: boolean indicator if this is the last iteration. | String |
actpage | If true we work on the current active page instead of any other node. @deprecated | boolean |
Displays Magnolia editBar which allows you to edit a paragraph. This tag is often used within contentNodeIterator, which in turn will set all relevant parameters automatically.
Can contain:JSP
Name | Description | Type |
---|---|---|
adminOnly | Show only in admin instance, default to true. | boolean |
contentNodeCollectionName | The contentNode collection. | String |
contentNodeName | The contentNode (i.e. paragraph) you wish to edit. | String |
deleteLabel | The text of the delete button, defaults to "Delete". Use "" to get no delete button. | String |
dialog | Name of the dialog to open. If specified, overrides the paragraph attribute, or the dialog name determined by the current paragraph if any. | String |
editLabel | The text of the edit button, defaults to "Edit". | String |
moveLabel | The text of the move button, defaults to "Move". Use "" to get no move button. | String |
paragraph | Name of paragraph (as defined in config). Does not have to be set inside "contentNodeIterator". | String |
showParagraphName | Show the paragraph name, default to false. | boolean |
Displays an edit button.
Can contain:empty
Name | Description | Type |
---|---|---|
adminOnly | Show only in admin instance, defaults to true. | boolean |
contentNodeCollectionName | * | String |
contentNodeName | If attribute is not used, a content node with the name of the page will be added. If contentNodeName attribute is set but with no value between the quotes, the properties are stored directly under the Web page. If a contentNodeName is set then a content node with the according name will be added. | String |
dialog | The dialog type. | String |
label | The button's label. (defaults to "Edit") | String |
small | Sets the size of the button, true for small button, false for a large one (defaults to true). | boolean |
template | Set display handler (JSP / Servlet), needs to know the relative path from WEB-INF. TODO: deprecate this ??? | String |
editLabel | @deprecated use the label attribute instead. | String |
paragraph | The paragraph type. @deprecated since 4.1, use the setDialog() instead. | String |
This is exactly the opposite of the ifNotEmpty tag.
Can contain:JSP
Name | Description | Type |
---|---|---|
contentNode | The content object to use. | String |
contentNodeCollectionName | Name of the collection holding the content node, e.g. "mainColumnParagraphs". | String |
contentNodeName | Inside a "contentNodeIterator": if not set, the current content node is taken. If set empty (contentNodeName=""), the top level content is taken. If specified, the named content node is taken. Outside a "contentNodeIterator": if not set or empty: the top level content is taken. If specified, the named content node is taken. | String |
inherit | Inherit the value from parent pages, if not set in the current one. | boolean |
nodeDataName | * | String |
path | The absolute path to the content. You must define the repository attribute if the content is not stored in the website repository. | String |
repository | Used if the uuid or path attribute is set. Defaults to "website". | String |
uuid | The uuid to use for finding the content. You must define the repository attribute if the content is not stored in the website repository. | String |
actpage | If true we work on the current active page instead of any other node. @deprecated | boolean |
atomName | @deprecated | String |
containerListName | @deprecated use the contentNodeCollectionName attribute instead. | String |
containerName | @deprecated use the contentNodeName attribute instead. | String |
This is exactly the opposite of the ifNotExisting Tag.
Can contain:JSP
Name | Description | Type |
---|---|---|
contentNode | The content object to use. | String |
contentNodeCollectionName | Name of the collection holding the content node, e.g. "mainColumnParagraphs". | String |
contentNodeName | Inside a "contentNodeIterator": if not set, the current content node is taken. If set empty (contentNodeName=""), the top level content is taken. If specified, the named content node is taken. Outside a "contentNodeIterator": if not set or empty: the top level content is taken. If specified, the named content node is taken. | String |
inherit | Inherit the value from parent pages, if not set in the current one. | boolean |
nodeDataName | * | String |
path | The absolute path to the content. You must define the repository attribute if the content is not stored in the website repository. | String |
repository | Used if the uuid or path attribute is set. Defaults to "website". | String |
uuid | The uuid to use for finding the content. You must define the repository attribute if the content is not stored in the website repository. | String |
actpage | If true we work on the current active page instead of any other node. @deprecated | boolean |
Checks if the current container is first in the collection.
Can contain:JSP
This tag has no attributes.
Checks if the current container is last in collection.
Can contain:JSP
This tag has no attributes.
Evaluates the body only if a container exitsts and / or the corresponding atom exists and is not empty.
Can contain:JSP
Name | Description | Type |
---|---|---|
contentNode | The content object to use. | String |
contentNodeCollectionName | Name of the collection holding the content node, e.g. "mainColumnParagraphs". | String |
contentNodeName | Inside a "contentNodeIterator": if not set, the current content node is taken. If set empty (contentNodeName=""), the top level content is taken. If specified, the named content node is taken. Outside a "contentNodeIterator": if not set or empty: the top level content is taken. If specified, the named content node is taken. | String |
inherit | Inherit the value from parent pages, if not set in the current one. | boolean |
nodeDataName | * | String |
path | The absolute path to the content. You must define the repository attribute if the content is not stored in the website repository. | String |
repository | Used if the uuid or path attribute is set. Defaults to "website". | String |
uuid | The uuid to use for finding the content. You must define the repository attribute if the content is not stored in the website repository. | String |
actpage | If true we work on the current active page instead of any other node. @deprecated | boolean |
atomName | @deprecated | String |
containerListName | @deprecated use the contentNodeCollectionName attribute instead. | String |
containerName | @deprecated use the contentNodeName attribute instead. | String |
Evaluates the body only if a container and / or the corresponding atom does not exist.
Can contain:JSP
Name | Description | Type |
---|---|---|
contentNode | The content object to use. | String |
contentNodeCollectionName | Name of the collection holding the content node, e.g. "mainColumnParagraphs". | String |
contentNodeName | Inside a "contentNodeIterator": if not set, the current content node is taken. If set empty (contentNodeName=""), the top level content is taken. If specified, the named content node is taken. Outside a "contentNodeIterator": if not set or empty: the top level content is taken. If specified, the named content node is taken. | String |
inherit | Inherit the value from parent pages, if not set in the current one. | boolean |
nodeDataName | * | String |
path | The absolute path to the content. You must define the repository attribute if the content is not stored in the website repository. | String |
repository | Used if the uuid or path attribute is set. Defaults to "website". | String |
uuid | The uuid to use for finding the content. You must define the repository attribute if the content is not stored in the website repository. | String |
actpage | If true we work on the current active page instead of any other node. @deprecated | boolean |
Delegates to an appropriate ParagraphRenderer, or include a JSP. This is typically used to render a paragraph. Within contentNodeIterator, parameters are provided automatically by the loop.
Can contain:JSP
Name | Description | Type |
---|---|---|
contentNode | * | info.magnolia.cms.core.Content |
contentNodeName | The name of the contentNode (i.e. paragraph) you wish to show. | String |
noEditBars | Set to true if the content should not be rendered in edit mode (edit bars, ...). | boolean |
container | @deprecated use the contentNode attribute instead | info.magnolia.cms.core.Content |
path | @deprecated file to be included (e.g. "/templates/jsp/x.jsp"). Just use basic jsp tags (i.e. <jsp:include/>) if you need to include a jsp in your templates. | String |
Adds the needed css and js links for magnolia edit controls. This tag should always bee added to html head.
Can contain:empty
Loads another page into actpage. One usage would be within a site-menu structure. loadPage does not nest pages, so the corresponding unloadPage tag will not revert to the previously loaded page, but restore actpage to the currently displayed page, i.e. the value it held before loadPage was called for the first time.
Can contain:JSP
Sub tag of loadPage, its body contains the path of the page to load.
Can contain:JSP
This tag has no attributes.
Displays the mainBar, i.e. the bar that allows you to change the page properties and switch to preview mode. This tag also add the CSS and JS links if not previously defined, but it's recommended to add the cms:links tag to the header of the page. CSS links are not valid inside the HTML body tag.
Can contain:JSP
Name | Description | Type |
---|---|---|
adminButtonVisible | Set this to false if you don't want to show the AdminCentral button. | boolean |
dialog | Name of the dialog for the page properties. (as defined in config) | String |
label | Label for the page properties button. | String |
paragraph | @deprecated use the dialog attribute instead | String |
Displays a newBar that allows you to create new paragraphs.
Can contain:JSP
<pre> <cms:newBar contentNodeCollectionName="mainColumnParagraphs" paragraph="samplesTextImage,samplesDownload,samplesLink"/> </pre>
Name | Description | Type |
---|---|---|
adminOnly | Show only in admin instance, default to true. | boolean |
contentNodeCollectionName | New paragraphs will be stored under this node's name. You will need the name for later retrieval of contents. | String |
contentNodeName | A single new paragraph will be stored as a node with this name. | String |
newLabel | Text of the button, defaults to "New". | String |
paragraph* | Comma separated list of allowed paragraph types. | String |
Writes out the content of a nodeData or - for nodeData of type binary - information of the nodeData.
Can contain:empty
<!-- EXAMPLE - outputting a nodes value into the page --> <!-- output the value stored in the node namd "title" --> <cms:out nodeDataName="title"/> <!-- EXAMPLE - outputting a node into an EL variable --> <!-- output the value stored in the node namd "myprop" to a variable named "check" --> <!-- thus exposing it to EL functionality --> <cms:out nodeDataName="myprop" var="check"/> <c:if test="${check == 'ok'}"> done </if> <!-- EXAMPLE - outputing a link from a uuid stored in a node --> <!-- output a relative link to the page whose UUID is stored in the node named "link" to a variable "relative_link" --> <cms:out nodeDataName="link" var="relative_link uuidToLink="relative" /> <a href="${relative_link}">go to page</a> <!-- EXAMPLE - writing a binary file's URL out as a variable --> <!-- this example shows how to display an image stored in the content repository using cms:out --> <cms:ifNotEmpty nodeDataName="image"> <cms:out nodeDataName="image" var="imageurl" /> <img class="navIcon" src="${pageContext.request.contextPath}${imageurl}" /> </cms:ifNotEmpty>
Name | Description | Type |
---|---|---|
contentNode | The content object to use. | String |
contentNodeCollectionName | Name of the collection holding the content node, e.g. "mainColumnParagraphs". | String |
contentNodeName | Inside a "contentNodeIterator": if not set, the current content node is taken. If set empty (contentNodeName=""), the top level content is taken. If specified, the named content node is taken. Outside a "contentNodeIterator": if not set or empty: the top level content is taken. If specified, the named content node is taken. | String |
dateLanguage | Set which date format shall be delivered. Does only apply for nodeDatas of type=Date. Language according to <code>java.util.Locale</code>. | String |
datePattern | Sets the output date format, as per java.text.SimpleDateFormat. Default is "yyyy-MM-dd". Only applies for nodeDatas of type=Date. <ul> <li><b>G </b> Era designator Text AD <li><b>y </b> Year Year 1996; 96 <li><b>M </b> Month in year Month July; Jul; 07 <li><b>w </b> Week in year Number 27 <li><b>W </b> Week in month Number 2 <li><b>D </b> Day in year Number 189 <li><b>d </b> Day in month Number 10 <li><b>F </b> Day of week in month Number 2 <li><b>E </b> Day in week Text Tuesday; Tue <li><b>a </b> Am/pm marker Text PM <li><b>H </b> Hour in day (0-23) Number 0 <li><b>k </b> Hour in day (1-24) Number 24 <li><b>K </b> Hour in am/pm (0-11) Number 0 <li><b>h </b> Hour in am/pm (1-12) Number 12 <li><b>m </b> Minute in hour Number 30 <li><b>s </b> Second in minute Number 55 <li><b>S </b> Millisecond Number 978 <li><b>z </b> Time zone General time zone Pacific Standard Time; PST; GMT-08:00 <li><b>Z </b> Time zone RFC 822 time zone -0800 </ul> | String |
defaultValue | Default value used if the expresion evaluates to null or an empty string. | String |
escapeXml | Determines whether output will be XML escaped. | boolean |
fileProperty | Sets which information of a file to retrieve. Only applies for nodeDatas of type=Binary. Supported values (sample value): <ul> <li><b>path (default): </b> path inlcuding the filename (/dev/mainColumnParagraphs/0/image/Alien.png)</li> <li><b>name </b>: name and extension (Alien.png)</li> <li><b>extension: </b> extension as is (Png)</li> <li><b>extensionLowerCase: </b> extension lower case (png)</li> <li><b>extensionUpperCase: </b> extension upper case (PNG)</li> <li><b>nameWithoutExtension: </b> (Alien)</li> <li><b>handle: </b> /dev/mainColumnParagraphs/0/image</li> <li><b>icon: </b>the default icon for the type of document</li> <li><b>pathWithoutName: </b> (/dev/mainColumnParagraphs/0/image.png)</li> <li><b>size: </b> size in bytes (2827)</li> <li><b>sizeString: </b> size in bytes, KB or MB - max. 3 digits before comma - with unit (2.7 KB)</li> <li><b>contentType: </b> (image/png)</li> <li><b>width: </b>image width in pixels (images only)</li> <li><b>height: </b>image height in pixels (images only)</li> </ul> | String |
inherit | Inherit the value from parent pages, if not set in the current one. | boolean |
lineBreak | Determines how line breaks are converted. Defaults to "<br />". Set to "" to have no line break at all, or any other value to be used as the line break. | String |
nodeDataName* | The name of the nodeData you wish to write out (required). There are following special values supported name, uuid, path, handle. If you specify one of special values, the behavior changes to output the name, uuid, path, or handle of the node instead of the value it stores. | String |
path | The absolute path to the content. You must define the repository attribute if the content is not stored in the website repository. | String |
repository | Used if the uuid or path attribute is set. Defaults to "website". | String |
scope | Scope for the attribute named from the "var" parameter. Setting this attribute doesn't have any effect if "var" is not set. | String |
uuid | The uuid to use for finding the content. You must define the repository attribute if the content is not stored in the website repository. | String |
uuidToLink | Transform a uuid value to a link. The following values are supported: <ul> <li>none: no uuid to link resolving. (default value)</li> <li>absolute: Resolve to a absolute link using the repository to uri mapping feature.</li> <li>handle: resolve to a absolute link but do not use the repository to uri mapping.</li> <li>relative: resolve to relative path. Path is relative to current page.</li> </ul> | String |
uuidToLinkRepository | Used if the uuidToLink attribute is set. The content is found in this repository. Defaults to "website". | String |
var | If set, the result of the evaluation will be set to a variable named from this attribute (and in the scope defined using the "scope" attribute, defaulting to PAGE) instead of being written directly to the page. | String |
actpage | If true we work on the current active page instead of any other node. @deprecated | boolean |
Everything between publicOnly tags will only be shown on the public instance.
Can contain:JSP
Executes a query on a Magnolia repository.
Can contain:empty
Name | Description | Type |
---|---|---|
nodeType | Nodetype for nodes to return. Defaults to "mgnl:content". | String |
query* | The query. | String |
repository | The repository to execute this query on. Defaults to "website". | String |
type | Query type: "sql" or "xpath". Defaults to xpath. | String |
var* | The result for this query (Collection of content objects) will be added to the pageContext with this name. | String |
Set contentNode in resource.
Can contain:empty
Name | Description | Type |
---|---|---|
contentNode | The content object to use. | String |
contentNodeCollectionName | Name of the collection holding the content node, e.g. "mainColumnParagraphs". | String |
contentNodeName | Inside a "contentNodeIterator": if not set, the current content node is taken. If set empty (contentNodeName=""), the top level content is taken. If specified, the named content node is taken. Outside a "contentNodeIterator": if not set or empty: the top level content is taken. If specified, the named content node is taken. | String |
forBodyOnly | If true the node is unset after the end tag. Default is false. | String |
inherit | Inherit the value from parent pages, if not set in the current one. | boolean |
nodeDataName | nodeDataName is not supported in this tag ! | String |
path | The absolute path to the content. You must define the repository attribute if the content is not stored in the website repository. | String |
repository | Used if the uuid or path attribute is set. Defaults to "website". | String |
scope | Attention this is not the jstl scope but the magnolia scope! Values are <ul> <li>local: same as paragraph</li> <li>paragraph: the current paragraph</li> <li>global: a globally use node (default value)</li> <li>page: same as page</li> <li>current: the current page</li> </ul> | String |
uuid | The uuid to use for finding the content. You must define the repository attribute if the content is not stored in the website repository. | String |
actpage | If true we work on the current active page instead of any other node. @deprecated | boolean |
container | @deprecated use the contentNode attribute | info.magnolia.cms.core.Content |
containerName | @deprecated use the contentNodeName attribute | String |
Exposes a content node to the pagecontext as a Map of nodeData, in order to access the exposed object using JSTL. Since JSTL doesn't allow calling a method like <code>Content.getNodeData(String)</code> the <code>Content</code> is wrapped into a <code>NodeMapWrapper</code> which exposes NodeData using a map interface. This tag can be useful in similar situations: (see @jsp.tag-example)
Can contain:empty
<pre> <cms:setNode var="currentNode"/> <c:if test="${!empty currentNode.title}"> <c:out value="${currentNode.title}"/> </c:if> </pre>
Name | Description | Type |
---|---|---|
contentNode | The content object to use. | String |
contentNodeCollectionName | Name of the collection holding the content node, e.g. "mainColumnParagraphs". | String |
contentNodeName | Inside a "contentNodeIterator": if not set, the current content node is taken. If set empty (contentNodeName=""), the top level content is taken. If specified, the named content node is taken. Outside a "contentNodeIterator": if not set or empty: the top level content is taken. If specified, the named content node is taken. | String |
inherit | Inherit the value from parent pages, if not set in the current one. | boolean |
nodeDataName | nodeDataName is not supported in this tag ! | String |
path | The absolute path to the content. You must define the repository attribute if the content is not stored in the website repository. | String |
repository | Used if the uuid or path attribute is set. Defaults to "website". | String |
scope | Scope for the declared variable. Can be "page" (default), "request", "session" or "application". | String |
uuid | The uuid to use for finding the content. You must define the repository attribute if the content is not stored in the website repository. | String |
var* | The content node will be added to the pagecontext with this name. | String |
actpage | If true we work on the current active page instead of any other node. @deprecated | boolean |
content | @deprecated use the contentNode attribute | String |
The unloadPage tag will restore actpage to the currently displayed page. This can be necessary after you have used loadPage to temporarily have access to a different page, e.g. for building a menu.
Can contain:empty
This tag has no attributes.