Home > Contents > Index >
Template Tag TOC  |   Alpha TOC  |   Tag Family TOC  |   Purpose TOC  |   Annotated TOC  |   Index 

 

RENDER.GETTEMPLATEURL

Generates a valid URL to an asset, rendered through a template, with optional wrapper page support. User-defined arguments will be packed if wrapperpage is specified. A vanity URL will be used if available.

Syntax

<RENDER.GETTEMPLATEURL
       [ADDSESSION="true|false"]
       [ASSEMBLER="uri assembler shortform"]
       [AUTHORITY="authority value"]
       [C="asset type"]
       [CID="asset id"]
       [CONTAINER="servlet|portlet"]
       [CONTEXT="context override"]
       [d="Device Group Suffix"]
       [resolvetemplatefordevice="A boolean value indicating whether parameter 'd' should be ignored or not."]
       [DEPTYPE="exists|none"]
       [DYNAMIC="true|false"]
       [FRAGMENT="fragment value"]
        OUTSTR="theURLVariable"
       [PACKEDARGS="stringFromPACKARGStag"]
       [SATELLITE="true|false"]
       [SCHEME="scheme value"]
        SITE="site name"
        SLOTNAME="name of slot"
        TID="caller Template or CSElement id"
       [TNAME="target Template or CSElement name"]
       [TTYPE="caller Template or CSElement"]
       [WRAPPERPAGE="name of uncached wrapper page"]
	   [WEBROOTNAME="webroot%quot;]
        />

</RENDER.GETTEMPLATEURL>

Attributes

addsession (optional)
Input. Whether or not to include session IDs in the URL when a browser is set to reject cookies. true means to encode session IDs in the URL. If this parameter is not specified, it is set to true by default.
assembler (optional)
Short form name for uri assembler class. Specifying an assembler overrides the default assembler used by Sites to construct URLs. Omitting this value will cause URLs generated by this tag to use the assembler registered with the highest priority in the request property file.
authority (optional, required if scheme is set)
Attribute that allows the user to specify a fully-qualified URL, when used in conjunction with scheme. URLs are of the form scheme://authority/path?query#fragment. For most purposes, authority corresponds to host:port for the given application. Specifying scheme and authority allows for fully-qualified URLs to be created, which is useful for sites with multiple domains and in other cases.
c (optional, required for explicit mode)
The asset type which will be rendered using the referenced template, that will be the target of the URL generated. The value of this attribute will be specified on the URL. If c, cid, and tname are set, then context data is ignored.
cid (optional, required for explicit mode)
The asset id which will be rendered using the referenced template, that will be the target of the URL generated. The value of this attribute will be specified on the URL. If c, cid, and tname are set, then context data is ignored.
container (optional)
Override attribute that specifies whether the URL will be generated for a servlet container or a portlet container. By default, the current container will be used. For practical purposes, leaving this blank or setting it to servlet should be sufficient. Legal values are servlet and portlet.
context (optional, required for context mode)
This attributes contains a context override parameter. If c, cid, and tname are not specified, then this attribute value will be examined to determine which template will be used and which asset for which a URL will be generated. If this value is not specified, then an ICS variable of the same name will be examined for the same purpose. If no context value can be located, then the URL will not be generated, and this tag will do nothing. Future versions of Sites will provide an interface that allows the context data to be set automatically. Manually overriding this value should be considered an advanced technique.
d (optional)
Device Group Suffix(a string that is common suffix of all the templates written for current device group). For example, if d ='Touch' and parameter tname = 'HomeLayout', the tag will try to find a template with name tname_d i.e. HomeLayout_Touch. If it exists, the tag will return the url of this template, otherwise will simply return the url of the template 'HomeLayout' i.e. actual tname provided.
resolvetemplatefordevice (optional)
true|false. Default is true. If 'false' is provided explicitly, the tag will ignore the parameter 'd' and will not try to find the device group specific template
deptype (optional)
Input. This attribute specifies whether approval dependency is exists, or none. exists (default) specifies that any version of the asset satisfies the dependency condition; none specifies no approval dependency on the asset.
dynamic (optional)
Input. Whether to create a static or a dynamic URL for the asset when the page is being rendered by the Export to Disk publishing method. true means to create a dynamic URL even if rendermode is set to export. false means to create a static URL if rendermode is set to export. If this parameter is not specified, it is set to false by default.
fragment (optional)
Optional attribute to specify a fragment on the URL. Fragments, sometimes known as anchors, allow browsers to advance to a specific location in a single web page. ex. http://www.myhost.com/foo.html#thirdParagraph.
outstr (required)
Input. Name of the variable that stores the URL generated by this tag.
packedargs (optional)
This attribute contains a series of arguments (name-value pairs) URL-encoded as a string.
satellite (optional)
Override attribute that forces the URL generated to be a URL for either Satellite Server or Sites. By default, the URL will automatically be set to whatever the containing page is set to. Legal values are true (Satellite Server URL) and false (Sites URL).
scheme (optional, required if authority is set)
Attribute that allows the scheme to be set in the URL. The scheme in the case of most URLs refers to the protocol and is usually set to either http or https. If this is left blank (and authority is left blank) then the URL will be relative to the current scheme and authority.
site (required)
The name of the site containing the Template to be referred to by the URL.
slotname (required)
This attribute defines an identifier for the "slot" that this URL represents. The concept of a URL as a slot is slightly unintuitive, but as it refers to an asset-template combination, it can therefore be changed to refer to any other asset-template combination. It should be reasonably easy to understand for humans and should be unique across all templates. Future versions of Sites will make extensive use of the slotname attribute.
tid (required)
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.
tname (optional, required for explicit mode)
The name of the Template to be called. 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.
ttype (optional)
This attribute identifies whether the code that contains this tag is a Template or a CSElement. The default value is Template, and CSElement is the other legal value. See tid.
wrapperpage (optional)
Input. If the target uses an uncached wrapper page, supply this argument with the name of that SiteCatalog page. The pagename argument will be passed as "childpagename". Please note that when using the wrapperpage parameter, non standard arguments are passed as packedargs. Such arguments will need to be unpacked before accessing. Standard arguments such as c, cid, and p will be preserved and not packed.
webrootname (optional)
Name of WebRoot to be used for retrieving vanity URL.

Description

This tag is the preferred method for generating a URL to an asset (provided that the asset is being rendered through a Template, which is the recommendation). It effectively replaces RENDER.GETPAGEURL in most (but certainly not all) cases.

Instances of this tag must contain information about who the caller is in order to operate correctly. The caller must be either another Template or a CSElement. This tag will not operate correctly without valid information about the caller. (see tid & ttype above).

RENDER.GETTEMPLATEURL operates in two modes: explicit mode and context mode.

In explicit mode, c, cid, and tname are explicitly specified as attributes to the tag. In essence, the asset identified by c and cid will be the subject of the URL along with the template named tname. If tname starts with "/" then the typeless template corresponding to tname will be used. Otherwise, the template corresponding to the specified tname and asset type ("c") will be called. Usually, the template name will correspond to a typeless layout template, which will dispatch to typed templates to render the actual asset. Explicit mode is the only mode that is currently supported.

In context mode, the context attribute (which defaults to an ICS variable of the same name if not present) will be examined to determine the template and asset to paired in the URL. Context mode support is not currently enabled in the Sites interface, however future versions may include it.

Error Numbers

The possible values of errno include:

Value
Description
-10004
A required parameter is missing .

Example

The following example is in JSP, but the XML syntax is analogous. The following example is the entire content of the FirstSite Mark II Product_C Link template. It constructs a URL back to the specified product through an uncached wrapper and a layout template.

In this tag, most of the attribute values are set from other variables in the variable space, either because they have been passed in, or because they have been explicitly looked up. The following table describes the origin of the ICS variables referenced below.

Variable origins
Variable name Origin
site The site variable is set as a resarg in all of the templates and SiteEntry assets. As such, it can be expected to be set correctly to the name of the current site.
tid The tid variable is set in the resargs of the called template. Because this code is in a Template, the tid attribute is set to the value of the tid variable. If this code had been located in a CSElement, this attribute would have been set to the value of the eid variable and the ttype attribute would also have been set to CSElement. See above for details.
c The c variable is specified on the URL and is passed unchanged into the Layout template.
cid The cid variable is specified on the URL and is passed unchanged into the Layout template.
<%@ taglib prefix="cs" uri="futuretense_cs/ftcs1_0.tld"
%><%@ taglib prefix="ics" uri="futuretense_cs/ics.tld"
%><%@ taglib prefix="render" uri="futuretense_cs/render.tld"
%><%@ taglib prefix="string" uri="futuretense_cs/string.tld"
%><%@ taglib prefix="assetset" uri="futuretense_cs/assetset.tld"%><cs:ftcs>
<%-- Record a compositional dependency for the template so that 
     pagelets generated by this template are managed properly --%>
<ics:if condition='<%=ics.GetVar("tid")!=null%>'>
<ics:then>
    <render:logdep cid='<%=ics.GetVar("tid")%>' c="Template"/>
</ics:then>
</ics:if>

<%-- Create an assetset so we can retrieve values 
     from this asset for use in the link --%>
<assetset:setasset 
          name="ProductSet" 
          type='<%=ics.GetVar("c")%>' 
          id='<%=ics.GetVar("cid")%>' />

<%-- Look up the attribute type name (we know it is Product_A but for
     replication support we must look it up --%>
<render:lookup key="ProductAttrType" varname="ProductAttrType" 
        site='<%=ics.GetVar("site")%>' tid='<%=ics.GetVar("tid")%>'/>
<%-- Look up the name of the name attribute (we know it is "name" but
     for replication support we must look it up --%>
<render:lookup key="NameAttrName" match=":x" varname="NameAttrName" 
        site='<%=ics.GetVar("site")%>' tid='<%=ics.GetVar("tid")%>'/>

<%-- Retrieve the name of the product --%>
<assetset:getattributevalues 
     name="ProductSet" 
     attribute='<%=ics.GetVar("NameAttrName")%>' 
     listvarname="NameList" 
     typename='<%=ics.GetVar("ProductAttrType")%>' 
     />

<%-- Look up the name of the layout template and of the wrapper SiteEntry --%>
<render:lookup site='<%=ics.GetVar("site")%>' varname="LayoutVar" 
        key="Layout" tid='<%=ics.GetVar("tid")%>'/>
<render:lookup site='<%=ics.GetVar("site")%>' varname="WrapperVar" 
        key="Wrapper" tid='<%=ics.GetVar("tid")%>' match=":x"/>

<%-- Construct a standard URL for this product.  The layout template
     will dispatch to the typed tempmlate that will render this 
     product in its detailed view. --%>
<render:gettemplateurl 
        outstr="aUrl" 
        tid='<%=ics.GetVar("tid")%>' 
        slotname="Product_CLink" 
        site='<%=ics.GetVar("site")%>' 
        c='<%=ics.GetVar("c")%>' 
        cid='<%=ics.GetVar("cid")%>' 
        tname='<%=ics.GetVar("LayoutVar")%>' 
        wrapperpage='<%=ics.GetVar("WrapperVar")%>' >
</render:gettemplateurl>

<%-- Render the link.  Be sure to stream the name and URL using
     the render:stream tag in order to ensure xhtml-compliance 
     of the response --%>
<a href='<string:stream variable="aUrl"/>'>
    <string:stream list='NameList' column="value" />
</a>

</cs:ftcs>

See Also

RENDER.LOOKUP

  Home > Contents > Index >

Oracle XML Tag Reference
Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.