Posts Tagged ‘tag’


render:lookup

The render:lookup tag is one of the important tag, which is used in looking up a  map value for a given Template or CSElement. We will now see the syntax of this tag, and its usage.

USAGE:

This render:calltemplate tag is used to Look up a map value for a given Template or CSElement.

SYNTAX:

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

<render:lookup
        key="name of lookup key"
        varname="output variable name"
        site="site name"
       [tid="id of template or cselement"]
       [ttype="CSElement|Template"]
       [match="x|x:|:x"]
/>

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

1. Key:  The name of the key corresponding to the value. The key is the only thing that can be hard-coded in a template; hard-coding asset names, types, or values is discouraged.

2. Varname: The output variable name to contain the value corresponding to the key.

3. Site: The name of the site corresponding to this mapping. (mapped values differ across sites).

4. Tid: The id of the template that owns the mapping (defaults to the id of the current template). If this tag is present in a CSElement, then the default is the CSElement id, and ttype must be set to CSElement.

Example usage of render:callelement:
<%-- Look up the name of the layout template --%>
<render:lookup
        site='<%=ics.GetVar("site")%>'
        varname="LayoutVar"
        key="Layout" 

<%-- Look up the name of the wrapper page's site entry.
     Note we want the asset name only, so we must specify
     the match filter. --%>
<render:lookup
        site='<%=ics.GetVar("site")%>'
        varname="WrapperVar"
        key="Wrapper"
        match=":x"/>

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.