Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Assuming you are working with dmHTML for now, most people get stuck on how they might output related link information in their webskin displays.

Tip

A custom tag specifically for building related content has been added to the code base: skin:RelatedContent

Code Snippet

In FarCry 4.0 you can get extended information about your array property using the bArrayAsStructs parameter. In the extended array you will find the typename property for your related content. We use this to correctly invoke the right content type without having to look up the typename.

Code Block
title./webskins/dmhtml/displayPageStandard.cfm
<!--- only bother if there is related content --->
<cfif arrayLen(stobj.arelatedids)>
  <!--- grab an array of extended data structs for processing --->
  <cfset aExtended=getData(objectid=stobj.objectid, bArraysAsStructs=true) />
  
  <cfloop from="1" to="#arrayLen(aExtended)#" index="i">
    <!--- create an instance of the relevant type based on typename --->
    <cfset oType=createobject("component", application.types[aExtended[i].typename]) />
    <!--- render a specific view for the content item, perhaps a teaser --->
    <cfset HTML=oType.getView(objectid=aExtended[i].objectid, template="displayTeaser") />
    <cfoutput>#HTML#</cfoutput>
  </cfloop>

</cfif>