New slot in the NavTree

Hi,I’m working on the navigation of our new site in Rx 6.5.2. What I want is to insert items in a slot of the NavTree to create a Top Menu on every pages (call by the Global Template). I can’t use the slot “nav_landingPage” because we already use it for something else in our navigation.
My problem is that I’m unable to read this slot. Do I have to configure something to make this work ?

Thanks,

Guillaume

Guillaume,

I tried creating a slot and adding it to the topnav template. I didn’t see any problems doing this. Could you tell me exactly what you tried to do, and where you saw the problem?

Dave

Hi,
My slot is working, I can put items in it. My problem is how to call this slot and work with it from my template ? I can’t call it like usual slot because when I preview a page item, the slot is at the NavTree level and I don’t know how to use it. What I need to do is to retrieve the “displaytitle” of the content in the slot and the link to that page to create a top menu.
Can you guide me ?
Thanks,
Guillaume

I was trying to do something similar, but came across a problem where i wanted a generic set of links for the top menu (ones that don’t change throughout the whole site and is only set once per site basis). My solution was to create a “special” navon element (’–navheader–’) and an associated template for that which parses from the $nav.root, finds the ‘–navheader–’ element (as sys_title) and displays submenu items (which are the links for the header)

The problem with the slot for me was that referencing the slot while in a specific folder only pulled in the slot information for the navon element in that folder. Ie. i could not create a “global” set of links to use throughout the site via the slot approach.

Using 6.5

Hi,
I’m trying to do about the same thing. Thanks for your solution. If I understand well, you create a folder with a navon only to manage your top navigation ?
I’m wondering if there is a better solution ?

Thanks anyway, I’m going to try that.

Guillaume

That is correct. I would also like to know if there is a better solution…I didn’t particularly like it either, but it was the best i could come up with :S…

You should be able to access this slot from a template attached to the NavTree (and assembled as a snippet in the Nav slot). There should not be any dependency on folder ids, unless there’s something I’ve overlooked.

I’ll try this and let you know if it works.

Dave

PS: Jit, why are you posting all these questions on President’s day? Guillaume has an excuse: he’s a Canadian, and they don’t have President’s day (they don’t even have a President). :slight_smile:

OK, here’s how to deal with this. As you’ve pointed out, when you assemble a Nav template, you are really assembling a snippet of the current Navon, and what you need is to assemble a slot on the “NavTree”.

You do this by cloning the Assembly Item, and then setting the node to $nav.root.

Here is a small example:


<div class="toppage">
   #__slotsetup("rffNavTopPage" "")
   #set($navTreeItem = $sys.assemblyItem.clone())
   $navTreeItem.setNode($nav.root)
   #set($sys.currentslot.relresults  =  $rx.asmhelper.assemble($navTreeItem,$sys.currentslot.slot,$completeparams))
   #foreach( $relresult in $sys.currentslot.relresults )
      #set($body = "$rx.doc.extractBody($relresult)")
      $body
   #end
</div>

In real life, you probably want to build a small macro for this.

Dave

Ahh…if only I had this answer before…(I had called Tech Support about it, but really didn’t get anywhere… I guess i should have posted it in the forums…:slight_smile: ). Good luck with the implementation Guillaume.

Jit

Hi,
I had tried to code you post. It does not return anything. Maybe I’m doing something wrong. I’m calling my template with that line in the Global Template

#slot("hecNav" "" "" "" "" "template=hecSnNavHzMenu")

The name of my slot is hecNavHzMenu.

And here is the code of my template (template name “hecSnNavHzMenu”)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>
	<head>
		<title>HEC Horizontal Menu</title>
	</head>
	<body>
		#__slotsetup("hecNavHzMenu" "")
		#set($navTreeItem = $sys.assemblyItem.clone())
		$navTreeItem.setNode($nav.root)
		#set($sys.currentslot.relresults  =  $rx.asmhelper.assemble($navTreeItem,$sys.currentslot.slot))
		#foreach( $relresult in $sys.currentslot.relresults )
			<li>$relresult.getProperty("displaytitle").String</li>
		#end
	</body>
</html>

Am I doing that right ?
Thanks,
Guillaume

isn’t your slot called hecNav? If so, that’s probably what you need to initialize in the _slotsetup.

The assemble line is incomplete, you need to make sure that the $completeparams is specified:

#set($sys.currentslot.relresults  =  $rx.asmhelper.assemble($navTreeItem,$sys.currentslot.slot,$completeparams))

Thank you Jit and Dave. It finally work as I wanted. I’m going to use that a lot for my navigation so it’s good to have a clean solution.

Thanks again,

Guillaume :slight_smile: