0

We are using DXA 1.7 and would like to populate the components dynamically on a page based on the condition. On a tridion page, what needs to be added (for dynamic CT) and when the dynamic logic need to be populated for a page load.

  • It is not clear to me what you are looking for, exactly. In particular the “based on the condition” part is not clear. Can you elaborate? – Rick Pannekoek Mar 13 at 18:46
1

You can use the GetEnityModel using ContentProvider.GetEntityModel (HERE). An sample implementation is available in the test namespace HERE. Per Rick's comments, it has been introduced in 1.2.

You can also use the DD4T API to retrieve the component presentation directly from the Broker. You can try to use the GetComponentPresentation. For your conditions to retrieve the template and components, you can use Broker query directly. Complete documentation of the broker query is available HERE.

You will have to mark the component template as dynamic in the CM side and publish it to the broker. You can also use dynamic assembly in the component template, if you would like to have a hybrid behavior.

I can only provide a generic answer since your question does not contain specific scenarios or approaches that you have already evaluated.

  • 1
    Do we need to load the dynamic content while building the page model? Since we will not have component presentation on the page, when should invoke the GetComponentPresentation? – Sikarwar Mar 13 at 0:54
  • I don’t get the remark about DXA 1.7 and not having access to ContentProvider.GetEntityModel; this method is available since DXA 1.2. – Rick Pannekoek Mar 13 at 18:45
  • Yes, I see its available. – Sikarwar Mar 13 at 20:29
  • @RickPannekoek, I have not used it in the earlier versions and I did not go back and check its availability from DXA 1.2. I have updated the information. Thanks for the feedback, as always. – Shiva Mar 13 at 23:11
  • @Sikarwar, If you are looking for code snippets, I suggest you update your question with relevant information and the community will definitely try to do the best to help out. Cheers. – Shiva Mar 13 at 23:12

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.