The 5 Most Important FatWire and WebCenter Sites Tags
I’ve been working with Oracle WebCenter Sites (FatWire) for over a year now. Here’s my guide to the 5 most important tags to learn with examples of their use.
1. The Content Server Context tag
First of all the most basic and important tag is ftcs. The ftcs tag sets the Content Server Context which tells Content Server that all the code within the opening and closing ftcs tags should be considered by Content Server.
Syntax
<cs:ftcs> Content Server tags here </cs:ftcs> |
2. The Asset Load tag
All Content objects in FatWire are called Assets. So while working with the content management system you will frequently need to work with assets (content).
Before you can start working with any asset you have to load it. You might be familiar with the fact that in FatWire/WCS there are two types of assets, basic asset and flex asset. To load a basic asset you will use the asset:load tag.
Syntax
<asset:load name="assetName" type="assetType" [objectid="object.id"] [field="fieldName"] [value="fieldValue"] [site="siteName"] [deptype="exact|exists|none"] [editable="true|false"] [option="editable|readonly|readonly_complete"] [flushonvoid="true|false"]/> |
Asset Load tag loads (retrieves and stores as an object in the memory) the asset according to the parameters. You can then use the asset and get its attribute and other asset related data by referring to the name given in the name parameter.
Other asset related tags use the name parameter to refer to the name of the asset loaded. The objectid parameter is the asset id.
The field and value parameters are optional. Field is for the attribute name and value represents its value. So, you might want to load an asset on the basis of one of its attribute values.
Example
Loading an article asset that has the title “Green Gardens”.
<asset:load name="articleAsset" type="Article_C" field="title" value="Green Gardens" /> |
3. The Asset Get tag
Once the asset is loaded its attribute’s values can be retrieved. For retrieving the value of an attribute the asset:get tag is simplest to use.
Syntax
<asset:get name="assetName" field="fieldName" [output="outputVariable"]/> |
Asset:get retrieves the value of the attribute/field specified in the field parameter for the asset referred in the name parameter and saves it in a variable given in output parameter (optional).
If the variable given in output parameter does not exist then it creates a new variable with the same name given in output.
Example
Getting the attribute named summary from article asset we loaded in the previous example and storing it in articleSummary variable.
<asset:get name="articleAsset" field="summary" output="articleSummary" /> |
If the output variable is not provided the value of the attribute is stored in a variable with the same name as the attribute.
For example if in the above the output variable articleSummary is not provided then the articleAsset field value will be stored in a variable named articleAsset.
4. The Set Asset tag
To load and get the attributes from a flex asset it is recommended to use the assetset:setasset tag.
Syntax
<assetset:setasset name="assetsetname" type="assettype" id="assetid" [locale="localeobject"] [deptype="exact|exists|none"]/> |
The assetset:setasset is similar to asset:load in a sense that it returns the reference to the flexasset as name and the type parameter is for the type of the flex asset as it is in asset:load.
The id is the asset id of the flex asset. There is no parameter for field and value because it is a flex asset which can have attributes as asset type.
Example
Loading a flex asset of type Article_C representing an article.
<assetset:setasset name="articleAsset" type="Article_C" id='<%=ics.GetVar(“cid”)%>'/> |
* If cid is the article asset id.
5. The Get Attribute Values tag
Assetset is the basic tag to load a flex asset and the first step to get/manipulate the attribute(s) of a flex asset. Once the asset is loaded tags like assetset:getattributevalues and assetset:getmultiplevalues can be used to retrieve attribute value(s).
Retrieving value(s) from an attribute of a flex asset can be achieved by using assetset:getattributevalues tag.
Syntax
<assetset:getattributevalues name="assetset name" attribute="attribute name" listvarname="list name" [typename="attribute asset type name"] [immediateonly="true|false"] [ordering="ascending|descending"]/> |
The name parameter represents the name of the asset that is loaded, for example the articleAsset flex asset we loaded above. In attribute parameter give the name of the flex attribute.
listvarname gets the name of the list which stores the value(s) of the attribute. It can be an already existing list or a new list.
Example
After we have loaded flex asset article we want to get its attribute named Body which represents the main body of article.
<assetset:getattributevalues name="articleAsset" attribute="Body" listvarname="bodyList" typename="articleAsset_A"/> |
The typename is for the attribute type. So, in our example the attribute type is articleAsset_A.
And that’s it. Please do ask any questions you have below the line and I’ll do my best to answer them as soon as I can.
Leave a reply
-
Hello Rabbia,
Do we get any samples project on creating the page templates(any article for that matter)
-Mrudul
-
Hello Rabbia,
Do you have any tutorial to learn fatwire CS coding from the scratch..?
-
Hello Rabbia,
Please explain how to display image attributes of a page in web page
Regards,
Lakshmi -
Can you explain the backend working of assetset tag ?
Like how backend queries work?