Pulling Related Host Specific Content excluding Global Content

Description

This example allows you to pull related content on a specific host without including global content that is assigned to System Host.

When using the method: $dotcontent.pullRelated by default the content from System Host is included in the results. To be able to only pull the results for your host you will need to use the method: $dotcontent.pull and create your own query including the relationship name.

Code

<ul>
	  ##Relationship Name
      #set($relationshipNameQ="Parent_Raalloytypes-Child_Raalloy")
      ##Pull Parent Content
      #foreach($alloyType in $dotcontent.pull("+structureName:RaAlloyTypes +(conhost:${host.identifier} conhost:${host.hostName}) ",0,"RaAlloyTypes.ordinal"))
      <li>$alloyType.title
        <ul>
          ##Query that includes the host condition and additionally is adding a condition to pull by relationship
          #set($relatedQuery="+structureName:RaAlloy +(conhost:${host.identifier} conhost:${host.hostName}) +${relationshipNameQ}:${alloyType.identifier}")
          #foreach($alloy in $dotcontent.pull($relatedQuery,0,"RaAlloy.ordinal"))
          <li>$alloy.title</li>
          #end
        </ul>
      </li>
    #end
</ul>