getting assembled items content type from parent template

I am trying to retrieve the content type of an item assembled of a slot, without actually using a separate template.

I am not sure what code I should be using to achieve this, but I’ve tried variations of $ with no luck.

#initslot("rffList" "")
	#if($sys.currentslot.relresults.size() > 0)
		#foreach($relresult in $sys.currentslot.relresults)
			#set($type = $

I’m obviously doing something wrong, what am I missing?

Nick D

Hi Nick

You get the content type name from item and not the assembly item:

#set($type = $relresult.Node.getPrimaryNodeType().Name)

It’s also returned like this:



That’s interesting. I use:

#set($content_type = $relresult.getNode().getPrimaryNodeType().getType())##

and what i get back is myContentTypeName (ie no “rx:” in front). From what i can tell, both of them should return the same value as we do use the same method. Could it be differing RX versions (i have been using it since 6.5.2)?

Wow, where do you learn about that code?

Thanks for the help everyone!

edit: that worked perfectly! I used the first example. Thanks jimbo and jitendra!

Eh…I learned about it the round about way: I knew what the java class relresult was then looked at the jar file corresponding to it and figured out what methods were available to that class.

But that was before I knew what I was doing (read experience). Of course now I would just look at the API (usually located at [RX ROOT]/Docs/Rhythmyx/Javadocs/index.html) :slight_smile: to figure out what actions i can do to a specific item.

I believe velocity equates Node => getNode method calls (if Node does not exist…same with all other method calls starting with “get”) hence the code that I gave should be identical to Jimbos (which is why i was wondering why he had the “rx:” in front of what was returned…