Fatwire initially provides some basic building assets, which we can use while setting up a site. Page, Query, Template, CSElement … is few of them.
Note: Fatwire treat every thing as asset (eg. Template)
Page asset is used to create site plan. We can define child parent relation ship within our site plan using page assets. It totally depends on our design how many level of hierarchy we will use. Its not possible to customize Fatwire provided assets (Page in our case), means we can’t introduce new attributes with these assets. But Fatwire provide a provision to create association. Using association, we can associate any asset type with our page asset.
1. How to create association with page asset?
- Login to system with admin rights
- Go to Advance environment
- Goto Admin > Asset Types > Page > Asset Associations
Here we will find all association with page asset (see Figure 1)
- To create a new association, click on “Add New” and fill the form (see Figure 2)
Name: Name of new association, please make it informative, we will be using this name to get the associated assets.
Description: Description we want to provide. Can be same as name
Child Asset: If we want to associate only specific asset type, then select that asset type from drop down. If any asset can be associated then leave it “Any”
Page SubTypes: If we are using page subtypes and want this association with only some specific sub types, then select the sub type otherwise leave it “Any”
Mirror Dependency Type: It’s a trade off and totally depends on business requirement. Select this value to Exact version if any change to the associated asset will require approval for publish of Page otherwise keep it Exists. I will suggest keeping it Exists.
Multivalued Association: single valued / multivalued
- Click “Add New Association” Button
We can find this new association on page creation form (eg. See Figure 3)
NOTE: We can create number of associations with page assets
2. How to access associated assets?
We can use <asset:children … /> tag to get the associated assets. The syntax is as follows:
<asset:children type=”Page” assetid='<%=ics.GetVar(“pageId”) %>’ list=”myList” code=”associationName” order=”nrank” />
type: asset type, “Page” in our case
assetid: Page asset id
list: named list which will refer to the fetched assets. We will use this list to get the asset ids
code: Give the name of association (which we have created)
order: “nrank” to return an ordered list. Applicable in case of multivalued association only.
We can use “myList” to get the associated assets. This list has two attributes (otype, oid)
otype: type of associated asset
oid: id of associated asset
Iterate through the list:
// Check for empty list. Its a common practice to avoid any error. Please see Common errors and their Prevention
<ics:if condition='<%=null != ics.GetList(“myList”)&& ics.GetList(“myList”).hasData() %>’>
<ics:listloop listname=”myList”><ics:listget listname=”myList” fieldname=”otype” output=”c” />
<ics:listget listname=”myList” fieldname=”oid” output=”cid” />…