Getting navon property via the global template

Is there a way of pulling through the value of a navon property through to the global template? Basically if a keyword has bee nset on the navon i want to remove some HTML markup. If i use the following i get the value of the navon that i want but it only works for items that have child nodes.

#set($navsection = $nav.self.getProperty(“rx:no_selector”).String)

How do i amend this to work at all levels?

Thanks in advance

it only works for items that have child nodes

What do you mean by child nodes? Do you mean you are getting the value only if the containing folder of the item has other folders in it.

Well i thought that was the case but after adding a test submenu to a bottom level folder it didnt make any difference. I can’t see how it would work on some navons but not others as it should be the ‘self’ node as in code below.

Ok - after much tinkering it seems that it is the nav image that determines if the navon value is pulled through or not?? If there is no navimage set it cant locate the navon’s property.

There are two properties on navon content type, no_selector and no_variable.
The property no_selector corresponds to Image Selector field in the navon content editor and no_variable corresponds to Variable Selector.
You have to set these values appropriately in the navon item to get them in the glabl template.

hi there,

we have added a custom property to the navon as well that is populated by a list of keywords - this is the value i am trying to pull through. When i view the source of the ‘view content’ the value is set and is there?

You can get the “nav” node in a global template with a macro like this:

#macro(get_navon_node)
#if(!$nav)##
#initslot("rffNav" "template=NavonLink")##
#if($sys.currentslot.relresults.size() > 0)##
#set($nav = $sys.currentslot.relresults.get(0).getBindings().get('$nav') )
#end##
#end##
#end##

Once you’ve done that, you can use $nav.hasProperty() and $nav.getProperty() as you would in a nav template.

note that the $nav template is not a normal content node (it’s a “proxy node”), but the simple functions will work.

I hope this helps

Dave

Thanks for the reply - i’m still a little confused as to what template i should be calling. Is this:
#initslot(“rffNav” “template=NavonLink”)##

a generic template?

Yes, it’s a generic template.

In the macro I posted, you don’t care what template you use, because all you really need is the content node, and this will be the same for ALL possible templates.

If you were going to examine the output of the template, or the bindings, then you would care about the template.

As it stands, the only important thing is that the Assembly Service gets called with the correct content item.

I’m still having trouble getting this to work:

#set($nav = $sys.currentslot.relresults.get(0).getBindings().get(’$nav’) )

This doesnt seem to be finding anything. Am i missing something?

Thanks in advance