Posts Tagged ‘render’


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.


In the previous post, we have discussed how to render text stored in a blob. In this post, we will know how to render an image which is stored in the blob.

The following code is used to render the image blob. Here, I’m using render:satelliteblob tag to render the image.

<!--load the child asset -->-

<assetset:setasset name="myasset" id='<%=ics.GetVar("childId") %>' type='<%= ics.GetVar("childType") %>' />

<assetset:getmultiplevalues name="myasset" byasset="false" prefix="atlst">

   <assetset:sortlistentry attributetypename="Content_A" attributename="my_image"/>

</assetset:getmultiplevalues>

<!--Render the Image -->

<ics:listloop listname="Imagelist">

    <ics:listget listname="Imagelist" fieldname="value" output="o_value"/>

    <render:satelliteblob service="img src" blobtable="MungoBlobs" blobkey="id" 

                    blobwhere='<%=ics.GetVar("o_value")%>' blobcol="urldata"/>
</ics:listloop>


//In this way, we can render an image in Fatwire using the Satellite blob tag.


If you have a requirement of using the Flex Family, and render the text stored in Blobs, this example would definitely help you.

For example, if you want to allow the user to enter a Huge text (that would not fit according to the normal RDBMS standards), then this concept of blobs can be used. Following are the steps that need to be done in order to successfully create and render the blob.

  • Create a flex attribute “text” with BLOB  as the Value Type, and if you want to specify any attribute editors like FCKEditor, EWebEditPro, etc, then specify them as well.
  • Enable that attribute in the Flex Definition, so that it becomes a part of the flex asset, and will be visible in the asset creation form.
  • Now, the content you enter in the form will be stored in the file system, instead of being stored in the database system.

After creation of the asset, the next thing to do is coding the template that renders the blob which we have created earlier.

  • In the import section of the jsp, import the blobservice tag library:
        <%@ taglib prefix="blobservice" uri="futuretense_cs/blobservice.tld"%>
  • Load the asset:
        <assetset:setasset name="myasset" id='<%=ics.GetVar("cid")%>' type='<%= ics.GetVar("c")%>'/>
  • Load the attribute from the asset
        <assetset:getattributevalues name="myasset" typename="PageContent_A" attribute="text"
                  listvarname="Textfile"/>
  • Render the blob:
      <ics:listloop listname="Textfile" maxrows='<%=ics.GetVar("rows")%>'>
                 <ics:listget listname="Textfile" fieldname="blobvalue" output="textvalue"/>
                 <blobservice:readdata id='<%=ics.GetVar("textvalue")%>' listvarname="Textdata"/>
                 <render:stream list="Textdata" filecolumn="urldata"/>
      </ics:listloop>

In the preview of your website/page, the text should be rendered.