Get Properties of a Landing Page via a Navon

Let me kind of set up our situation first, then go through what I’ve been able to do thus far.

We have a site which will effectively have several sites within it (they’re not technically different sites, but we’re setting it up so that different people have access to different sub-folders within the site). Within each of these folders there are a certain set files that will exist. Most of these files use a Generic content type, but a couple of the pages needed to be slightly different. As a result we threw in those changes into the template itself, checking for whether it was a landing page and the name of the navon in it’s folder.

On one of these pages, we need to display a link, but the link changes based on the subfolder (and it’s something we want hard-coded on the page). We’re getting this link from another page (of a different content type) elsewhere in the site. And this is where it gets tricky.

At first we thought of doing it as a snippet, but for various reasons this solution ended up not being a very viable one.

We then tried to see if we could basically crawl our way over to that particular content item and grab the information. Well, we’ve gotten most of the way: We looped through the navons off the main navigation and picked up the right folder based on the navon’s sys_title. The page with the URL is always going to be the landing page for that particular folder, so we got the content item by doing $navon.getProperty(“nav:landingPage”).

However, this is where I’ve gotten stuck since nothing I’ve tried has successfully been able to actually get information from that content item via .getProperty(“rx:whatever”).String

Here is the entire block of code just so you can see what we’re doing:

#if($sys.item.getProperty("rx:sys_title").String == 'index')
    #initslot("vtSNav" "template=extSnNavGeneric")
      #if($sys.currentslot.relresults.size() > 0)
         #foreach( $relresult in $sys.currentslot.relresults )
			##slotItem($relresult)
            #set($navname = $relresult.getNode().getProperty("rx:sys_title").toString())
    		#if($navname=="--Get_Involved--")
				<p>From advising faculty on local needs, to working with youth in a 4-H
					club or serving as a Master Gardener, Virginia Cooperative Extension
					relies on trained volunteers in all aspects of its work.  Whatever your
					expertise or interest, we would be happy to discuss volunteer
					opportunities with you.  Please Contact us for more information.</p>
    		#elseif($navname=="--Links--")
    			<p><a href="http://www.state.va.us/">Commonwealth of Virginia</a><br />
				<a href="http://www.csrees.usda.gov/">USDA/CSREES</a><br />
				#set($submenu = $relresult.getNode().getParent().getNodes("nav:submenu"))
				#foreach ($navon in $submenu)
					#set($sys_title = $navon.getProperty("rx:sys_title").String)
					#if ($sys_title == "--Contact_Us--")
						$navon.getProperty("nav:landingPage")		
						##$navon.getProperty("nav:landingPage").getProperty("rx:fourhcenter").String
						##$navon.getProperty("nav:landingPage").getProperty("rx:fourhurl").String
					#end
				#end
				</p>
    		#end
         #end
      #end
    #endslot("vtSNav")
#end

Any idea of how to get the information from that page? Or perhaps an alternate method that works. Basically the requirements are that the link must show up on this page and that it is impossible for people to edit the link out (even though they can edit the page otherwise). Thanks.

-Josh

$navon.getProperty("nav:landingPage")

gives you an PSContentNode. You just need to get the node. Thus the solution for you should be (where propertyiwant is whatever property you need from that content item):

$navon.getProperty("nav:landingPage").getNode().getProperty("rx:propertyiwant").toString()

dumb getNode vs. getNodes :rolleyes: I tried getNodes. didn’t try getNode (singluar). Well at least it was easy…

The JavaDoc is highly useful for cases like this. It is available on your Rhythmyx Server:

http://server:port/Rhythmyx/Docs/Rhythmyx/Javadocs/

Is it possible to access the $sys.params of a descendant navon or a landing page thereof? I want the sys_folderid of a descendant folder… help appreciated.