Relationship IDs for Items in Inline Variant Slots

Does the CMS create a relationship ID for each item in a WYSIWYG field’s inline variant slot? If it does, is that relationship ID accessible from a snippet template?

We want our snippet templates that generate a link to a CMS content item (via the inline variant slot) to display their slot relationship IDs (which would be a unique value) in the rel attributes of their links. For instance, an item in the inline variant slot that generates a link to a PDF file would display:

<a href="/directory/filename.pdf" rel="relid_999999">Title of PDF (PDF file, XX KBs)</a>

This behavior would be useful to us, because we could capture the value of the rel attribute with the JavaScript that creates our WebTrends log files and then analyze how many users click on that link. The content ID of the item does not work for us, because we sometimes have an item in the inline variant slot more than once.

Thanks.

Inline variant slot relationships are stored in the PSX_OBJECTRELATIONSHIPS table just like relationships in “ordinary” slots set up via the Active Assembly Table Editor (aka Related Content Control.) Anything that goes in that table has to have a relationship ID. But I don’t know how to access the relationship ID in templates. We’d be interested in doing the same thing as you, for the same reasons, although we haven’t reached that stage yet.

Thanks for the reply, Andrew. Another thing we’d like to do is to modify the content in the HTML head tag (e.g., adding a CSS rule or script reference) or in our footer (e.g., adding a link to the Adobe Reader plugin) based on the items in those slots. At this point, I’m wondering if the contents of the inline link and inline variant slots are accessible at all from Velocity. Has anyone found a method for this?

Thanks.

Hello again. Does anybody from Percussion have a response to my question? In essence, I’d like to know whether an inline variant can access any data about itself (e.g., its relationship id) or its rendering context (e.g., the content type of the item calling the WYSIWYG that is, in turn, calling the inline variant), and whether an inline variant can return data about itself (say, that it is a link to a PDF file) to the item calling it. Thanks.

James,

The answer to most of your questions is No.

A snippet generally has no concept of it’s parent, although Binding Variables can be passed from the parent template to the snippet template, and this is the way that most people do this. Variables from the “Bindings” tab are accessible in the snippet, but variable defined with #set (in the Velocity source) are not. This has been discussed several times at great length in this forum.

As Andrew points out, inline snippets are no different from regular snippets: there is a relationship id. You can find the relationship ids of the “children” in a slot using the PSOGetSlotContents extension, but once again the snippet doesn’t know it’s own relationship id.

It is simple to use data about the item itself (e.g. that it is a PDF file) in snippet templates.

I hope this helps

Dave