How to use the render:calltemplate tag in Fatwire?

Posted: January 25, 2012 in Fatwire
Tags: , , , , , , , , , , , , ,

render:calltemplate

The render:calltemplate is one of the well know tag, which is frequently used by the fatwire coders. We will now see the syntax of this tag, and its usage.

USAGE:

This render:calltemplate tag is used when we would like to invoke a Template, or a CSElement, as either a PAGELET (A small part of the page), or an Element, for rendering an asset.

Though we have another tag  “render:callelement” to invoke CSElements, this render:callelement tag is used to invoke both Templates and CSElements as well.

SYNTAX:

The following is the JSP syntax of the render:calltemplate tag. This is in reference with the “Tag Reference” guide.

<render:calltemplate
        site="site name"
        slotname="name of slot"
        tid="caller Template or CSElement id"
       [ttype="caller Template or CSElement"]
       [c="asset type"]
       [cid="asset id"]
       [tname="target Template or CSElement name"]
       [context="context override"]
       [style="pagelet or element or embedded"]
       [variant="template variant name"]
       [packedargs="packed arguments"]>

   [<render:argument name="variable1" value="value1"/>]

</render:calltemplate>

We will now discuss the some important arguments which are specified above.

1. site:  This is a required field. This specifies the name of the site containing the Template to be invoked.

2. slotname: This is also a required field. This attribute defines an user friendly name for the “slot” that is being filled with the called template.

3. tid: This is also a required field. This specifies the id of the template in which this tag is located. If this tag is located in a CSElement, then the value of this attribute should be the id of the CSElement, and ttype should be set to CSElement.

4. context: This is an optional field. If c, cid, and tname are not specified, then this attribute value will be examined to determine which template to call and which asset to render using the specified template.

5. tname: This is an optional field. This field specifies the name of the Template to be called. Typeless templates must be prefixed with a ‘/’. This is required if c and cid are set. If these three attributes are not set, the called template will be determined by looking at context data.

6. style: This is an optional field. The possible values for this field are pagelet, element, embedded.

7. c: This is an optional field. This field specifies the asset type to be rendered by the called Template. The value of this attribute will be passed to the called code.

8. cid: This is an optional field. This field specifies the id of the asset to be rendered by the called Template. The value of this attribute will be passed to the called code. This is required if c is set.

Example usage of render:callelement:

<render:calltemplate tname='<%=ics.GetVar(“ViewTypeVar”)%>’
site='<%=ics.GetVar(“site”)%>’
tid='<%=ics.GetVar(“tid”)%>’
slotname=”PageView”
c='<%=ics.GetVar(“c”)%>’
cid='<%=ics.GetVar(“cid”)%>’
ttype=”Template”>
</render:calltemplate>

In our next post, we will learn how to deal with the “render:lookup” tag, which is frequently used in combination with “render:calltemplate” tag.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s