Tag reference sheet

Tag library reference for the following tag libraries:

cms taglib

Core tag library for CMS

This is version 2.1.

  • adminOnly Everything between adminOnly tags will only be shown on an authoring instance, not on a public instance
  • attribute adds an attribute to the request within an includeTemplate tag
  • button Adds a button to a parent bar
  • contentNodeIterator iterate over contentNode collection
  • editBar This will display a Magnolia editBar, which allows you to edit a paragraph
  • editButton display edit button
  • ifEmpty this is exactly the opposite of the ifNotEmpty Tag
  • ifExisting this is exactly the opposite of the ifNotExisting Tag
  • ifFirstContentNode checks if the current container is first in the collection
  • ifLastContentNode checks if the current container is last in collection
  • ifNotEmpty evaluates the body only if a container exitsts and / or the corresponding atom exists and is not empty
  • ifNotExisting evaluates the body only if a container and / or the corresponding atom does not exist
  • includeTemplate Include a JSP
  • links Add the needed css and js links for magnolia edit controls
  • loadPage Loads another page into actpage
  • loadPagePath sub tag of loadPage, its body contains the path of the page to load
  • mainBar Displays the mainBar, i
  • newBar Displays a newBar that allows you to create new paragraphs
  • out Writes out the content of a nodeData or - for nodeData of type binary - information of the nodeData
  • pageIterator iterate over Content (page) collection
  • publicOnly Everything between publicOnly tags will only be shown on the public instance
  • query Execute a query on a magnolia repository
  • set Set contentNode in resource (globally available for the page)
  • setNode Exposes a content node to the pagecontext as a Map of nodeData, in order to access the exposed object using JSTL
  • unloadPage The unloadPage-tag will restore actpage to the currently displayed page
  • user Set the current user (info
  • init @deprecated this tag does nothing in magnolia 2
Required attributes are marked with a *

<cms:adminOnly>

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

Example

      
<cms:adminOnly>
    <cms:editBar/>
</cms:adminOnly>

    

Attributes

NameDescriptionType
showInPreviewShow content in the Preview. Default is false.boolean

<cms:attribute>

adds an attribute to the request within an includeTemplate tagCan contain: EMPTY

Attributes

NameDescriptionType
name*String
valueString

<cms:button>

Adds a button to a parent bar. Must be nested into a mainBar or newBar to work.Can contain: EMPTY

Attributes

NameDescriptionType
dialogName*Name of the dialog to openString
label*Label for this buttonString
position*Where to add this button. Can be left or right. Default is leftString

<cms:contentNodeIterator>

iterate over contentNode collectionCan contain: JSP

Example

      
<cms:contentNodeIterator contentNodeCollectionName="mainColumnParagraphs">
    <cms:adminOnly>
        <cms:editBar/>
    </cms:adminOnly>
    <cms:includeTemplate/>
</cms:contentNodeIterator>

    

Attributes

NameDescriptionType
beginZero-based index of first item to process, inclusive.int
contentNodeCollectionName 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. String
endZero-based index of last item to process, inclusive.String
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
stepProcess every stepth element (e.g 2 = every second element).int
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

<cms:editBar>

This will display a 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: EMPTY

Attributes

NameDescriptionType
adminOnlyShow only in admin instance, default to false.boolean
contentNodeCollectionNamethe contentNode collectionString
contentNodeNamethe contentNode (i.e. paragraph) you wish to editString
deleteLabeltext of the delete button, defaults to "Delete"; use "" to get no delete buttonString
editLabeltext of the edit button, defaults to "Edit"String
moveLabeltext of the move button, defaults to "Move"; use "" to get no move buttonString
paragraph name of paragraph (as defined in config). Does not have to be set inside "contentNodeIterator" String

<cms:editButton>

display edit buttonCan contain: EMPTY

Attributes

NameDescriptionType
contentNodeCollectionNameString
contentNodeNameString
labelString
paragraphString
smallboolean
templateString
editLabel@deprecatedString
parFile@deprecatedString

<cms:ifEmpty>

this is exactly the opposite of the ifNotEmpty TagCan contain: JSP

Attributes

NameDescriptionType
actpageboolean
atomNameString
contentNodeCollectionNameString
contentNodeNameString
nodeDataNameString
containerListName@deprecated use contentNodeCollectionNameString
containerName@deprecated use contentNodeString

<cms:ifExisting>

this is exactly the opposite of the ifNotExisting TagCan contain: JSP

Attributes

NameDescriptionType
actpageboolean
contentNodeCollectionNameString
contentNodeNameString
nodeDataNameString

<cms:ifFirstContentNode>

checks if the current container is first in the collectionCan contain: JSPThis tag has no attributes.

<cms:ifLastContentNode>

checks if the current container is last in collectionCan contain: JSPThis tag has no attributes.

<cms:ifNotEmpty>

evaluates the body only if a container exitsts and / or the corresponding atom exists and is not empty Can contain: JSP

Attributes

NameDescriptionType
actpageboolean
atomNameString
contentNodeCollectionNameString
contentNodeNameString
nodeDataNameString
containerListName@deprecated use contentNodeCollectionNameString
containerName@deprecated use contentNodeString

<cms:ifNotExisting>

evaluates the body only if a container and / or the corresponding atom does not existCan contain: JSP

Attributes

NameDescriptionType
actpageboolean
contentNodeCollectionNameString
contentNodeNameString
nodeDataNameString

<cms:includeTemplate>

Include a JSP. This is typically used to render a paragraph. Within contentNodeIterator, parameters are provided automatically by the loop.

Can contain: JSP

Attributes

NameDescriptionType
contentNodeinfo.magnolia.cms.core.Content
contentNodeNamethe name of the contentNode (i.e. paragraph) you wish to showString
pathfile to be included (e.g. /templates/jsp/x.jsp)String
container@deprecated use contentNodeinfo.magnolia.cms.core.Content

<cms:links>

Add the needed css and js links for magnolia edit controls. This tag should always bee added to html head.

Can contain: EMPTY

Attributes

NameDescriptionType
adminOnly Show links only in admin instance, default to true. You can set it to false if you want magnolia css and js files added also for a public instance. boolean

<cms:loadPage>

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

Attributes

NameDescriptionType
level???int
pathpath of the page to be loadedString
templateName???String

<cms:loadPagePath>

sub tag of loadPage, its body contains the path of the page to load

Can contain: JSP

This tag has no attributes.

<cms:mainBar>

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 (also if some browser support it, css links are not valid inside the html body tag.

Can contain: EMPTY

Attributes

NameDescriptionType
adminButtonVisibleSet it to false if you don't want to show the AdminCentral buttonboolean
labelLabel for the page properties buttonString
paragraphName of the paragraph for the page properties (as defined in config)String

<cms:newBar>

Displays a newBar that allows you to create new paragraphs.

Can contain: EMPTY

Example

      
<cms:newBar
contentNodeCollectionName="mainColumnParagraphs"
paragraph="samplesTextImage,samplesDownload,samplesLink"/>

    

Attributes

NameDescriptionType
adminOnlyShow only in admin instance, default to false.boolean
contentNodeCollectionName stored under this name, you will need the name for later retrieval of contents. (required) String
newLabeltext of the button, defaults to "New"String
paragraphcomma separated list of paragraph typesString

<cms:out>

Writes out the content of a nodeData or - for nodeData of type binary - information of the nodeData

Can contain: EMPTY

Example

      
<cms:out nodeDataName="title"/>
<cms:out nodeDataName="myprop" var="check"/>
<c:if test="${check == 'ok'}">
  done
</if>

    

Attributes

NameDescriptionType
contentNodeCollectionNameString
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
dateLanguageString
datePatternString
filePropertyString
inheritInherit the value from parent pages, if not set in the current one.boolean
lineBreak defaults to BR-tag. 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)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
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

<cms:pageIterator>

iterate over Content (page) collection

Can contain: JSP

Attributes

NameDescriptionType
hiddenAttribute If a page contains a boolean property with this name and it is set to true, the page is skipped by the iterator. Defaults to "hidden". String

<cms:publicOnly>

Everything between publicOnly tags will only be shown on the public instance.

Can contain: JSP

Example

      
<cms:publicOnly>
    Public now!
</cms:publicOnly>

    

Attributes

NameDescriptionType
showInPreviewShow content in the Preview. Default is true.boolean

<cms:query>

Execute a query on a magnolia repository.

Can contain: EMPTY

Attributes

NameDescriptionType
nodeTypeNodetype for nodes to return. Defaults to "mgnl:content"String
query*the queryString
repositoryThe repository to execute this query on. Defaults to "website"String
typeQuery 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

<cms:set>

Set contentNode in resource (globally available for the page)

Can contain: EMPTY

Attributes

NameDescriptionType
contentNodecontentNodeobject to be set as global contentNode for the pageinfo.magnolia.cms.core.Content
contentNodeNamecontentNode's name to be loaded from the current active pageString
container@deprecated use contentNodeinfo.magnolia.cms.core.Content
containerName@deprecated use contentNodeNameString

<cms:setNode>

Exposes a content node to the pagecontext as a Map of nodeData, in order to access the exposed object using JSTL.

Can contain: EMPTY

Example

      
<cms:setNode var="currentNode"/>
<c:if test="${!empty currentNode.title}">
  <c:out value="${currentNode.title}"/>
</c:if>

    

Attributes

NameDescriptionType
content Use the node directly passed using this attribute, instead of fetching a node using contentNodeName/contentNodeCollectionName info.magnolia.cms.core.Content
contentNodeCollectionNameName 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
scopeScope for the variable. Can be "page" (default), "request", "session", "application"String
var*The content node will be added to the pagecontext with this name.String

<cms:unloadPage>

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.

<cms:user>

Set the current user (info.magnolia.cms.security.User) into a pageContext variable.

Can contain: EMPTY

Attributes

NameDescriptionType
anonymous Display anonymous users as "anonymous". Default to false (variable will not be set for anonymous users) boolean
var*The current user will be set to the pageContext variable with this name.String

<cms:init>

@deprecated this tag does nothing in magnolia 2.x

Can contain: EMPTY

This tag has no attributes.