Wednesday, April 3, 2013

How do I render attribute from a page on a template

The other day I was trying to use the below code to get page attributes on template

<asset:get name="theCurrentPage" field="customField" output="assetname"/>
<ics:getvar name="assetname"/>

Unfortunately, it did not work,

Then the other way to do the same stuff which I was trying to achieve was this

<assetset:setasset name="pAsset" type='<%=ics.GetVar("c")%>' id='<%=ics.GetVar("cid")%>'/>

<assetset:getattributevalues name="pAsset" typename="PageAttribute" listvarname="pageAList" attribute="pagebody" />
<ics:listget fieldname="value" listname="pageAList" output="theCurrentAssetCopy"/>

which worked.

So whats the difference in the above 2 approaches.

The approach one is used/works only for system generated fields like name. The 2nd approach works for custom defined fields too.

No comments: