3

I'm implementing dynamic component presentation on DD4T Java version2. To get DCP on DD4T, following method is used.

org.dd4t.core.factories.ComponentPresentationFactory.getComponentPresentation(component ID, component Template ID)

This method requires component template ID as parameter, but hard coding template's ID is bad because ID is different between development environment and live environment. So I want to get template' ID by template's name to avoid hard coding ID in source code.

What is good way to do that?

Regards,

| improve this question | | | | |
2

It looks like we lost some functionality in the factory in the transition from dd4t-1 to dd4t-2; it was possible to get a DCP by just component id (defined by template priority) as well as by output type. The provider can still do it, but the factory no longer calls the method.

That means that, if you don't need to specify the template to get the correct version out of the broker, you could add it to the factory or request (or bride) a dd4t developer to do it for you.

| improve this answer | | | | |
  • This is still possible by adding a "tcm:0-0-0" uri as parameter. – Raimond Feb 10 '16 at 15:18
0

To my knowledge its not possible to get these...

What you could look into is creating a labelService (key, value pairs) where you can store these kind of labels into from the CMS.

| improve this answer | | | | |

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.