I have an existing site with a fairly large amount of content, and quite a few local and global templates. I’ve inherited the site from a previous developer, who assigned global templates from the folder properties - opposed to using a dispatch template and using local templates.
Now to the meat of my problem; I need every content item in one folder and its’ subfolders to use a specific local template. Here’s a mock-up of my nav.
So every item in the products folder and all its subfolders need to use the same local template.
I’m completely unsure of how to do this in a dispatch template. Is this even possible? I know I can assign templates to items in a specific folder, but I’ve not seen anything on grandparent folders…
The implementation left by your predecessor is valid; indeed, it’s recommended.
Each page should have both a Global Template and a Local Template. The global template acts as a "container, and generally includes the navigation and banner, as well as references to the CSS used to format the content of the page. The Local template defines the content of the individual page Content Items. For details, in the Rhythmyx Implementation Guide (Version 6.5.2 link), see the discussion on p. 123.
I want every content item in the “products” folder and all its subfolders to use a specific local template. I’m trying to avoid having to assign the local template for every folder or every content item.
In Percussion CM, there is no association between the Local Template and the Folder. Local Templates are associated with Content Types.
One way I can think to achieve the result you want would be to created a Folder Effect that would disallow adding a Content Item to a Folder unless the Content Item was of a specific Content Type.
That doesn’t really make sense considering I can use a Dispatch Template to achieve something similar to what I want.
For example; I have bindings in a dispatch template that says if the item being previewed has a specific folder id, then to use a particular local template.
The Dispatch Template condition you cite is essentially a workaround for the absence of an association between the Folder and the Template.
A few things to consider for your implementation:
First, The JCR node object we return during assembly only includes the Folder ID of the Owner Folder of the Content Item. It does not include the IDs of any Ancestor Folders, nor does it include any Folder Properties.
The Folder structure in Content Explorer is defined by the individual Relationships between the Folders. A specific Folder only has Relationships to its Owner (parent) and its Dependents (children).
Finally, JEXL does not include an IN operator or anything equivalent.
So an alternative implementation would be to
[ul]
[li]Add a property to the Products Folder.
[/li][li]Create a JEXL function that searches up the Folder tree from the Content Item’s Owner for this property, and returns its value.
[/li][li]Create a Dispatch Template that selects the correct Local Template based on this value.
[/li][/ul]
This implementation is less restrictive than my original suggestion, but it requires more attention to ensure that users don’t change the value of the Folder Property.
Ah okay. That makes sense… though I think for the speed at which I have to develop this site, I’ll need to just make more bindings in the dispatch template.