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"/>