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,

2 Answers 2

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.

1
  • This is still possible by adding a "tcm:0-0-0" uri as parameter.
    – Raimond
    Commented Feb 10, 2016 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.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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