Render attribute

From VYRE

(Redirected from Render attributes)
Jump to: navigation, search

Render attributes allow custom attributes to by added to Unify at a template, site, page and portlet level.

Render Attribute

Contents

Order of importance

The render attributes are referenced in the following level of importance:

  • Portlet
  • Page
  • Site
  • Template

meaning that an attribute set on a site will apply on all pages expect those which have overridden it, and in turn those will apply to all portlet except those which have been overridded at a portlet level, etc.

Setting attributes

Portlet

The render attributes for a portlet can be viewed and set by clicking on the properties icon from the portlet bar.

Page

The render attributes for a page can be viewed and set by editing the page.

Site

The render attributes for a site can be viewed and set by editing the site.

Template

The render attributes for a template can be viewed and set by editing the template.

Display

Velocity

The render attributes can be used in velocity, for example in static code portlets, in the form

$render_name

so for a render attribute testVar the velocity variable would be $render_testVar.

XSL

The render attributes can be used in XSL in the form

$render_name

so for a render attribute testVar the XSL would need to include

<xsl:param name="render_testVar" ></xsl:param>
<xsl:value-of test="$render_testVar"/>

JSTL

The render attributes can be used in JSTL, for example in templates, in the form

${render["name"]}

so for a render attribute testVar the velocity variable would be ${render["testVar"]}

Inheritance of Render attributes

Inheritance of Render attributes

Render attributes can be made available in sub pages of the page on which it is defined by checking the Available in sub pages check box.

Examples of use

Render attributes should be used where there should be small differences to pages, based on which page or portlet the user is currently on.

For example it might be required to have a class in the body tag of each page, with a different class for certain pages. To do this include the following line in the JSTL

<body class="${render["bodyClass"]}">

And the variable can then be set on the pages where it is required.

Another example might be the same XSL being used in many portlets, with the only difference required a different title. If the following line is included in the XSL

<h2><xsl:value-of test="$render_listTitle"/></h2>

The title can be set in the portlet, avoiding the need for a long choose statement, based on page ids.

See Also

Personal tools