4

We are trying to extend the FSPageDAO in a storage extension and in the create(CharacterData page, String relativePath) method, we would like to get a list of all the components placed on that page.

How can we do this?

6

You can always try to access the package as described here using a deployer extension. Or if you want to stick to the Storage extension, you might be able to re-use the Utilities class provided in the link above and then use its getComponentPresentationsDocument method (or another method in such class) to access the package files and/or contents.

2
  • Are you suggesting using a reference of Deployer Extension in Storage extension...I would say it will definitely mess up the whole architecture and specifically in those cases where both Storage Extension and Deployer Extension are in place. By the way, I received my knowledge from the SDL Tridion Forum itself and with lots of discussion I kind of concluded that it was not possible, may be you try to share some sample code which will work in Storage Extension Dec 7 '13 at 13:30
  • I'm not saying you should implement both, rather within the Storage Extension use the logic in the classes provided in the link above to access the info in the XML files in the package, since apparently, the information you need is not accessible/exposed by default in the storage extension methods. The package should still be available in the Incoming folder. By the way, you know the components in the page beforehand (I mean at publish time), maybe you can add that information in the page output and then read it in the storage extension and remove it when you are done with your logic. Dec 9 '13 at 15:20
2

I asked this question over an year back and per my knowledge, there is no straight-forward way to achieve this.

The data the deployer passes to your method (CharacterData page) is actually your rendered Component Presentation (the ouput that your PT will generate for your page), so if you want just a list of component presentations you could generate some XML in your page template :

<componentpresentations>
<componentpresentation>
<component id="tcmid of component" />
<componenttemplate id="tcmid of componenttemplate" />
</componentpresentation>
</componentpresentations>

If you want to have BOTH the normal output of the page and the list of components then there is no list of components available to your code via the CharacterData interface; you will have to push a data fragment into your output as a comment (either client or server side) and read that from your code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.