Interacting with content relationships is also pretty easy with the dotcontent tool. There are 2 methods that will help. The only difference is one doesn't take a sort, or extra query conditions, and the other does. In Example 1 here we are getting the relationships for a piece of content with Identifier "asbd-asd-asda-asd" and asking for 10 of them to return. The "false" parameter is saying to get the children. If that was "true" it would pull the parents.

To specify a sort by criteria by field variable name as listed in the structures portlet, if blank it will sort by the relationship order, also the varible named is accepted to sort the results by last modified date.

Example 1:

  1. #foreach($content in $dotcontent.pullRelated("relationshipName","identifier",false,10,""))  
  2.       $content.title  
  3. #end  

In Example 2 we have added a condition and a sort. See the doc here

  1. #foreach($content in $dotcontent.pullRelated("relationshipName","identifier","+someField:someValue",false,10,""))  
  2.       $content.title  
  3. #end  
comments powered by Disqus