Snippet Template and Slot

I have a content type and I created two templates a Page Template and a Snippet template for it. I have included a slot in the page template.

Is there anyway, I can access the slot and its contents from the snippet template?

Thanks
Ravi

That’s the whole point of slots.

In the page template, you’d use #slot(“slotname” “” “” “” “” “template=snippetTemplate”)

If only it were that simple! You also need to drag and drop the templates into the “allowed” subfolder for that content type (or vice versa), edit the slot so the content type and the snippet template are “allowed content”, edit the page template so the slot is one of the “contained slots” listed in the Slots tab, make sure the page template (if it is the only one) is the default for that content type and the relevant site(s) it will be used on, etc, etc, etc. That is one of the reasons why we have one dispatch snippet template used for all content types and slots, which contains all the logic for deciding which snippet to use in its bindings.

Thanks for the replies Nick and Andrew,

I know we have API through which we can access the fileds of a content item. Similarly, if I have the GUID of a content item, can I write a java extension through which I can access the content item’s slots and the content items added in those slots?

Regards
Ravi

Yes, there is an API for this. In the PSO toolkit (look in the “Code & Snippets” forum) there is a Slot Tool, which has a “getSlotContents()” method. This should do what you want it to.

Searching this forum will provide instances of where other people are using this method.

There is Javadoc included with the PSOToolkit. If it doesn’t answer your question, let us know.

Dave