Sub-global templates?

Any suggestions on how to implement “sub-global templates”, so perhaps the logo and the footer would automatically appear on every site in the system (the Global Template) while the header text would vary by division but automatically appear on every site in a division (a “sub-global” template)? I’ve noticed that well-formed XHTML “include files” can be inserted into header and footer slots, which would allows pages to be customized without using the Workbench, but that method would require them to be inserted page by page.

You could do something with the navigation slots. For example, what we are doing is for different websites (units) is that we have a “header content item” (which is set once per site, this is a brief with a unique sys_title, say --header–) in which you put the unique unit header name.

As part of the global template, we are calling the header navigation template,which in turn renders finds “–header–” in the submenu on the Nav Tree element and only renders that…

Alternatively, you could use a new slot in the Nav Tree Element:
http://forum.percussion.com/showthread.php?t=323&highlight=navigation

I haven’t been very successful at this.

PSO suggested using node_slot in the global template to accomplish it:

#node_slot($nav.root "sFooter "" "" "" "" "")

I added that line to my global template and added a Brief to a new Footer slot in the NavTree. But the content isn’t rendering when I preview the Generic page.

Changing the code in the Global Template

  		#slot("sNav" "" "" "" "" "template=SnInclude")## 

gives a more encouraging error message that at least indicates it’s finding my slot:

Problem assembling output for item: 18-101-860 with template: SnInclude exception: Property rx:callout not found see log for stack trace.

I’m using a Brief content type to contain my footer so SnInclude basically consists of

#field("callout")##

Right, so when it goes through the navigation tree looking for the brief, I assume that all the items have the callout field defined (including navons /bases)? If not, you will have to set a condition that finds exactly what you’re looking for (the brief CT) in the template “snInclude”

Ie i check to make sure that the content type is a brief before doing anything specific to that content type…

Not sure what you are trying to do, but we are setting up one global template for all of our sites, with variables set up in the Publishing tab (like $rxs_navbase in FastForward) to change the behaviour of slots, templates, etc all the way down the chain for each site. These have to be set up as bindings in the global template. Setting up default values are a bit of a faff - for example to give one variable a default value of 5, the following is necessary:

$rx.cond.choose($tools.math.toInteger($sys.variables.cms_maxtraillength)==null,5,$tools.math.toInteger($sys.variables.cms_maxtraillength))

I’m not sure whether those variables can contain lengthy bits of HTML but it might be worth a try.

This is on Rhythmyx 6.5.2.

Andrew.

Interesting option, Andrew. But my main goal is to allow higher-end users to add HTML headers and footers without using the Workbench, and variables under the Publishing tab wouldn’t be customizable by those users.

I looked at the solution proposed in http://forum.percussion.com/showthread.php?t=323 but the code seemed more complicated than I needed. I’m not assembling navigation; I just need a place to store snippets that will be added to each page through the global templates, and the NavTree happens to allow that.

I’m getting a new error message:

Problem assembling output for item: 19-101-860 with template: SnInclude exception: templatename and templateid may not both be null see log for stack trace

But at least Rhythmyx is seeing all my three templates:

Global template:
#slot(“sFooter” “” “” “” “” “template=SnNavFooter”)##
SnNavFooter:
#slot(“sNav” “” “” “” “” “template=SnInclude”)##
SnInclude:
#node_slot($nav.root “sFooter” “” “” “” “” “”)##

Jit, I thought that when I specified sFooter in the node_slot, it would only look at the content item in that one slot, and that content item has a callout field. That’s why I thought #field(“callout”)## would work.

But when I change SnInclude to
#field(“displaytitle”)##
I get the NavTree’s display title.

When I add a template parameter to SnInclude, like this,

#node_slot($nav.root “sFooter” “” “” “” “” “template=SnNavBottom”)##

I get my regular bottom navigation, not my footer snippet.

Unfortunately I haven’t dealt with additional slots in the navigation. The method that I have been using is the sys_title to trigger certain actions. I’m sure others who have added the additional slots in the navigation can help you out here. If you would like to see how i’ve done it, I’d be more than happy to paste my code here.

Another way to allow my webmasters to customize their templates outside of Rhythmyx is by using $rx.doc.getDocument(). This line of code inserts an HTML snippet:

$rx.doc.getDocument("$rxs_navbase/includes/header.inc.html")

Velocity won’t parse the include file the way it parses global templates, however, so $rxs_navbase or Velocity code won’t work within it. But you can use <base href> similarly to $rxs_navbase, along with using relative paths (“images/” instead of “/images/” or "$rxs_navbase/images/).

For us, in the Preview context, $rxs_navbase points to absolute paths on our webmasters’ servers (most of them have their own - hundreds of them) and relative paths (on their servers) in the Publish context. So, in essence, webmasters can update their templates without having access to the Workbench, by editing their include files before publishing.

Michael

Your method seem better than configuring the dynamic menu to pass the site ID in order to bring up a specific global template.

I’m not sure why I would not use your method exclusively. Off hand it does not seem to have any drawbacks and is much more straight forward to configure.

Can anyone see any drawbacks with using this method? Does creating a preview menu to pass the site id offer any advantage?

db.

Can you not just setup the header and footer as a slot which ‘high-end users’ can then add snippets to?

You could setup a set of options which they can then choose as they see it? Or am I missing the point?

I guess the main advantage of the method Michael is using is it is easy to manage hundreds of sites.

Creating a preview menu for each site seems like it would break down after about 50 sites ( we currently have about 9,000 pages ).

Yes, my original idea was to use node_slots and the NavTree, so high-end users could include header and footer code in the global template. But I haven’t been able to make that work for me. Other people have - the advice in this thread is great help. But until I figure out what I’m doing wrong, I thought of trying $rx.doc.getDocument().

We don’t need to create any preview menus these days, now that we’re using Smart Preview.

I was under the impression that sub-global templates could be accomplished by specifying them at the folder level?? I need to change the global template two levels under the site root but the global template I want to use is not showing up in the list of global templates available to the folder (attachment: folderGT.jpg) . It looks like the folder can only use global templates associated with a site, not all global templates available like the site uses (attachment: publisherGT.jpg).

Is there a way to accomplish by specifying the global template at the folder level without being associated with a site? If not, why is this option even available?