If you want to pull all the details based on an identifier then you should use the following method:
#set ($content = $dotcontent.find($identifier))
If you are trying to pull just one result then you should use the following method:
#set ($newsList = $dotcontent.pull("+structureName:YOURSTRUCTURENAME +YOURSTRUCTURENAME:$identifier",1,"")) #if ($newsList.size() > 0) #set ($item = $newsList.get(0)) $item.title #end
The following method should be used to obtain values from the structure, especially if there is more than a single value.
You can use 0 to pull all the results HOWEVER it is much more efficient (and you should) set a limit/number. To whatever is appropriate.
If you specify the unique key (name) of parent category, you can return a list of all subcategories.
To pull only published data/live data you need to add the following +live:true to the query.
#set ($cont = $dotcontent.pull("+structureName:YOURSTRUCTURENAME +live:true",0,"")) #if ($cont.size() > 0) #foreach($con in $cont) $con #end #end
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.
#foreach($content in $dotcontent.pullRelated("relationshipName","identifier",false,10,"")) $content.title #end
In Example 2 we have added a condition and a sort. See the doc here
#foreach($content in $dotcontent.pullRelated("relationshipName","identifier","+someField:someValue",false,10,"")) $content.title #end
Use a standard pull to begin with, then use the generator to randomly pick one:
#pullContent('+type:content +live:true +deleted:false +structureInode:70483 +languageId:1' '100' '') #set ($list = $UtilMethods.randomList($list,1)) #set ($content = $list.get($math.toInteger(0)))
Great for tables/divs where you need to alternate the colour of a row - we also use jquery on the dashboard (but this works better).