I have a slot with multiple content types associated with it, but i would like to call only one content type in one of my page templates that’s using this slot. How can i do that?
Paddy
I have a slot with multiple content types associated with it, but i would like to call only one content type in one of my page templates that’s using this slot. How can i do that?
Paddy
I’ve never done it, but it seem theoretically possible. If you can extract the content type ID using sys_contenttypeid into the bindings of a dispatch template, then you could dispatch the items you want to show to the appropriate content, and all others could be dispatched to a “blank” template that would render nothing. There are probably some other approaches using a JSR-170 query to only select the items you want, but I’m not sure how to use that outside of an autoindex slot.
-J
Paddy,
Do you mean that you want to display only the content from one particular content type in the page template? If so, then you can initialize the slot manually, check for the content type, and then only display that.
#initslot($slotname $params)##
#if ($sys.part.render)##
#if($sys.currentslot.slot && $sys.currentslot.relresults.size() > 0)##
##
#foreach($relresult in $sys.currentslot.relresults )##
#set($currItem = $relresult.getNode())##
#set($currNType = $currItem.getPrimaryNodeType().getType())##
#if($currNType.equals("myContentType"))##
##
## This is where you can display stuff that you want for the particular content type
##
#end##
#end## foreach $relresult ...
#end## if $sys.currentslot.slot ...
#end## if $sys.parts.render ...
#endslot($slotname)##