Home > Contents > Index >
Template Tags 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.
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"] [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"] [variant="template variant name"] [wrapperpage="name of uncached wrapper page"] /> [<render:argument name="variable1" value="value1"/>] </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 totrue
by default.assembler
(optional)- Short form name for uri assembler class. Specifying an assembler overrides the default assembler used by Content Server 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 formscheme://authority/path?query#fragment
. For most purposes, authority corresponds tohost:port
for the given application. Specifyingscheme
andauthority
allows for fully-qualified URLs to be created, which is useful for sites with multiple domains and in other cases.c
(optional)- 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
, andtname
are set, thencontext
data is ignored.cid
(optional)- 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
, andtname
are set, thencontext
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 areservlet
andportlet
.context
(optional)- This attributes contains a context override parameter. If
c
,cid
, andtname
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 nocontext
value can be located, then the URL will not be generated, and this tag will do nothing. Future versions of CS Direct will provide an interface that allows thecontext
data to be set automatically. Manually overriding this value should be considered an advanced technique.deptype
(optional)- Input. This attribute specifies whether approval dependency is
exists
, ornone
.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 ifrendermode
is set toexport
.false
means to create a static URL ifrendermode
is set toexport
. If this parameter is not specified, it is set tofalse
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 Content Server. By default, the URL will automatically be set to whatever the containing page is set to. Legal values are
true
(Satellite Server URL) andfalse
(Content Server 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
orhttps
. If this is left blank (andauthority
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 CS Direct 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 toCSElement
.tname
(optional)- The name of the Template to be called. This is required if
c
andcid
are set. If these three attributes are not set, the called template will be determined by looking atcontext
data.ttype
(optional)- This attribute identifies whether the code that contains this tag is a
Template
or aCSElement
. The default value isTemplate
, andCSElement
is the other legal value. Seetid
.variant
(optional)- This attribute specifies the name of the Template variant to render. Template variants enable multiple code implementations of a Template (for example, WEP vs XHTML). Future versions of CS Direct may implement this feature; as of the current release it is not yet supported.
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".
c
,cid
, andp
will be preserved. All other arguments are passed aspackedargs
to allow for easy wrapperpage creation.Parameters
- render:argument (optional)
- Nested parameter tag. The render:gettemplateurl tag allows arbitrary argument tags to be added in order to add name/value pairs to the URL to be generated.
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
, andtname
are explicitly specified as attributes to the tag. In essence, the asset identified byc
andcid
will be the subject of the URL along with the template namedtname
. If tname starts with "/
" then the typeless template corresponding totname
will be used. Otherwise, the template corresponding to the specifiedtname
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 CS Direct interface, however future versions may include it.errno
The possible values of
errno
include:
Value Description -10004 A required parameter is missing .Example
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, thetid
attribute is set to the value of thetid
variable. If this code had been located in a CSElement, this attribute would have been set to the value of theeid
variable and thettype
attribute would also have been set toCSElement
. 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.p The variable p
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:argument name="p" value='<%=ics.GetVar("p")%>'/> </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
Home > Contents > Index > ![]()
FatWire JSP Tag Reference
Copyright 2005,2006,2007 by FatWire Software
All rights reserved.