Translate

Monday, November 25, 2013

Example 7: Site Plan

This example illustrates how to render SITE PLAN in different cases.

CASE 1: If you know Page name or asset id.

GENERAL STEPS TO FOLLOW:
  1. Load the page asset (using asset:load tag) 
  2. Get the site node from SitePlanTree table (using asset:sitenode tag) 
  3. Load the node (using siteplan:load tag)
  4. Get ChildList from loaded node (using siteplan:children tag or using siteplan:listpages tag)
  5. Loop through childlist to get Page name/id (using ics:listloop tag) 
a) Using siteplan:children tag

<asset:load name="target" type='Page' field="name" value="Home" site="<%=ics.GetVar("site")%>"/>
<!--  Get site node -->
<asset:getsitenode name="target" output="PageNodeId"/>
<!-- Load Home page as a siteplan node object -->
<siteplan:load name="ParentNode" nodeid='<%=ics.GetVar("PageNodeId") %>'/>
<!-- Obtain Home page's child node, save in list and order them by their rank -->
<siteplan:children name="ParentNode" list="ChildPages" order="nrank" code="Placed" objecttype="Page"/>
<!-- Loop through list to get page names's under Home page node -->
<ics:if condition='<%=ics.GetList("ChildPages") !=null %>'>
<ics:listloop listname="ChildPages">
<ics:listget listname="ChildPages" fieldname="id" output="aid"/>
<asset:load name="ThePage" type="Page" objectid='<%=ics.GetVar("aid") %>' />
<p><asset:get field="name"/></p>
</ics:listloop>
</ics:if>

b) Using siteplan:listpages tag (continue after loading the parent node (using siteplan:load) as shown above)

<!-- Query the SitePlanTree table and then creates a list of pages, starting with the page node that you specify. -->

<siteplan:listpages name="ParentNode" placedlist="placedPages" level="1" />
<!-- Loop through list to get page names under specified page node -->
<ics:if condition='<%=ics.GetList("placedPages") != null %>'>
<ics:listloop listname="placedPages">
<p><ics:listget listname="placedPages" fieldname="PageName"/></p>
</ics:listloop>

</ics:if>



CASE 2: Querying from root node i.e. Publication Node of the site. This is required when you want to extract and display information about the site structure from the top down. You can even list the pages which are placed or unplaced.

GENERAL STEPS TO FOLLOW:
  1. Load the publication (using publication:load tag) 
  2. Get the publication id (using publication:get tag)
  3. Query the SitePlanTree table for a root node of the site plan (using siteplan:root tag)
  4. Loop through list to get publication nid (using ics:listloop tag) 
  5. Load the node (using siteplan:load tag)
  6. Get ChildList from loaded node (using siteplan:children tag)
  7. Again loop through childlist if there child pages are required as shown in CASE 1
<publication:load name="thisPub" field="name" value='<%=ics.GetVar("site") %>'/>
<publication:get name="thisPub" field="id" output="thePubID"/>
<siteplan:root list="PubRoot" objectid='<%=ics.GetVar("thePubID") %>'/>
<ics:if condition='<%=ics.GetList("PubRoot") != null %>'>
<ics:listloop listname="PubRoot">
<ics:listget listname="PubRoot" fieldname="nid" output="rootNodeid"/>
<siteplan:load name="RootNode" nodeid='<%=ics.GetVar("rootNodeid") %>'/>
<siteplan:children name="RootNode" list="RootChildPages" order="nrank" code="Placed" objecttype="Page"/>
<ics:if condition='<%=ics.GetList("RootChildPages") !=null %>'>
<ics:listloop listname="RootChildPages">
<p><ics:listget listname="RootChildPages" fieldname="name"/></p>
</ics:listloop>
</ics:if>
</ics:listloop>
</ics:if>

INFO:
  • Using siteplan tags can be trickier when you want specific information, so please read about them before you use them.
  • While coding for siteplan, always keep in mind what table column we are getting after the query. Read the tags properly, its written there.
  • Keep CS Explorer (FatWire)\ Sites Explorer (Oracle WCS) handy to see which field's/column's value you are retrieving.
----------------------------------------------------
SUGGESTIONS/COMMENTS ARE INVITED
----------------------------------------------------

1 comment:

Guddu said...

I am not sure what exactly you want me to check. You can mail me if any other information or suggestion required on fatwire.dev@gmail.com