Getting an items properties based on content id

Hi

In Rhythmyx 6.5 I have a couple of dropdown menus in a content editor which store the content id of other items held in Rhythmyx. I want to be able to access the properties of those content items on the parent page by passing in the content id from the content editor. is this something that can be done?

eg I have contact content type which store values (content ids) of for an assistant and manager.

On the page template I would like to show the name of the assistant and the manager together with a link.

Cheers
James

You have a few choices for this.

Probably the simplest approach is to build 2 autoslots: one for the manager and one for the assistant. You can use a JCR Query "where rx:sys_contentid = :mgr_id … " etc.

The downside of Autoslots is that they force the item to be republished, even when incremental publishing is used. If you only have a few hundred of these pages, I wouldn’t worry about this. If you have thousands of them, you might want to consider another solution.

Another thing you can do is access the fields programmatically. You’ll probably need to write a small piece of Java code (exposed as a JEXL function) that loads the current Node based on the content id (as a String). I don’t think we have one of these yet, but it’s a good beginner’s project.

The last approach is to turn the content ids into relationships. We’ve written some code that is part of some forthcoming demos that uses an input translation to create a relationship from the content id. Unfortunately, this code probably isn’t in a form that it can be easily used outside the project it’s been built for, but it’s not so complicated that you couldn’t do something like it yourself. Ask me about this offline if you feel you need relationships.

Dave