This example illustrates how to render BASIC ASSET in different situations.
GENERAL STEPS TO FOLLOW:
<asset:load name="anyName" type='<%=ics.GetVar("c")%>%>' objectid='<%=ics.GetVar("cid")%>' flushonvoid="true" />
<asset:scatter name="anyName" prefix="anyPrefixName" />
GENERAL STEPS TO FOLLOW:
- Load the basic asset (using asset:load tag)
- Scatter the loaded basic asset (using asset:scatter tag)
- Retrieve information after scattering the asset via prefix:attributename (using ics:getvar tag)
<asset:load name="anyName" type='<%=ics.GetVar("c")%>%>' objectid='<%=ics.GetVar("cid")%>' flushonvoid="true" />
<asset:scatter name="anyName" prefix="anyPrefixName" />
<ics:getvar name="anyPrefixName:name"/>
CASE 2: If you know asset type, a field, value and site. This is generally used to get association using asset:children tag after the asset is loaded.
<asset:load name="anyName" type="assetTypeName" field="name" value="someAssetName" site='<%=ics.GetVar("site")%>'/>
(Use asset:children to get associations... COVERED IN LATER EXAMPLES) <asset:get name="anyName" field="description" /> <ics:getvar name="description"/>
INFO:
CASE 2: If you know asset type, a field, value and site. This is generally used to get association using asset:children tag after the asset is loaded.
<asset:load name="anyName" type="assetTypeName" field="name" value="someAssetName" site='<%=ics.GetVar("site")%>'/>
(Use asset:children to get associations... COVERED IN LATER EXAMPLES) <asset:get name="anyName" field="description" /> <ics:getvar name="description"/>
INFO:
- flushonvoid ensures that pages cache for the page is flushed if asset is not loaded or asset is deleted.
- Don't use this tag to render flex assets, its very costly (in terms of retrieving info from db as flex asset stores data in various tables whereas basic asset stores info in one table)
- Never hardcore asset id (cid) as this asset id keeps on changing from one environment to other. Also try to avoid hardcoding asset type (try to use render:lookup tag)
- After the asset is loaded, use asset:scatter tag if you want all the attributes in one go or if only 1 or 2 attributes are required, then use asset:get tag.
----------------------------------------------------
SUGGESTIONS/COMMENTS ARE INVITED
----------------------------------------------------
No comments:
Post a Comment