3

I have the following scenario:

I have Component C1 which is linked from component C20. C20 has a dwt with call to render component presentation for all linked components (in this example C1 with Component Template CT1).

All component templates are dynamic.

Components C20 is added to a page P1 and page is published. P1 output is as expected. C1, C20 are marked as Published in GUI.

To summarize:

  • P1 has C20-CT20 and calls RenderComponentPresentation():
    • C20 calls RenderComponentPresentation(C1,CT1)

  1. In Tridion C1 is reported as published, but I can not display it on a page as ComponentPresentation (C1 with CT1). Am I doing something wrong or do I have to publish C1 directly (for example through event system during P1 publishing) to have this working?

  2. When I change C1 and republish C1 directly I would like to have P1 (which calls C20) output changed to reflect this. Is this possible, and if it is, what do I have to do during publishing?

Edit:

Here is a more detail explanation:

Nothing is published from the CM except page P1. All CT's are dynamic. P1 has one component presentations, C20 component with CT20 component template. C20 has a link to component C1. C1 can be rendered with component template CT1.

So, P1 with PT1 looks like:

<h1>Hi, I am P1</h1>
<!-- TemplateBeginRepeat name="Components" -->
@@RenderComponentPresentation()@@ (this will render C20 with CT20)
<!-- TemplateEndRepeat -->

C20 with CT20:

<h2>Hi, I am C20</h2>
<!-- TemplateBeginRepeat name="Component.Fields.linkedcomponents" -->
@@RenderComponentPresentation(Field,"CT1")@@
<!-- TemplateEndRepeat -->

Trying to make situation more clear:

  1. CT1 (which renders C1) is "Published as Dynamic Component", "Output format: REL"
  2. CT20 (which renders C2) is "Published as Dynamic Component", "Output format: REL"
  3. P1 is aspx Page and on the file system this is the content:

<h1>Hi, I am P1</h1> <tridion:ComponentPresentation runat="server" PageURI="P1" ComponentURI="C20" TemplateURI="CT20"/>

Requirements:

Change C20, republish C20, change is visible on all pages where C20 is used as component presentation (default broker functionality, working as expected)

Change C1, republish C1, change is visible on all pages where C1 is "indirectly" added (not working as page is not calling C1 directly)

Possible solution: Change CT20 to:

<h2>Hi, I am C20</h2>
 <!-- TemplateBeginRepeat name="Component.Fields.linkedcomponents" -->
<tridion:ComponentPresentation runat="server" PageURI="P" ComponentURI="Field" TemplateURI="CT1"/>
<!-- TemplateEndRepeat -->

and add a c# code fragment to publish all linkedcomponents (in this case C1)

This somehow looks more like a workaround then a solution, so here I am, asking for help :)

Additional information (functional level):

It seems that I am failing to explain what my challenge is. Let me try from functional perspective: All pages contain at least one commercial block. Commercial block consists of 1 or more commercials. When new commercial is added to existing commercial block, it needs to be visible on all pages that are using that block asap. When existing commercial is changed (for example 20% discount instead of 10%), this needs to be visible on all pages that contain commercial block that has this commercial asap.

For the technical part, I can not use embed CP as I would have to republish very large number of pages very often. I opted to use Dynamic CP for Commercial block and Dynamic CP for individual Commercial. Commercial block is just a title and a list of links to individual commercial components. CT Commercial block can be added to a page as component presentation (which makes content editor life easier) and when page is published CT Commercial block is stored in the broker DB and shown on the page <tridion:componentpresentation.... tag is generated).

So, my first challenge is sorted out with this approach. I can change Commercial block, publish it from CM to Broker DB and change will be visible on all pages using that block (as they are getting that CP from the broker DB)

Second part of my challenge is not solved. I want to change individual commercial and publish just that commercial component and make the change visible on all pages that are using Commercial block that contains that individual commercial.

2 Answers 2

1

It would be beneficial if you add a little more additional information like what output your Component Templates are generating (and what they are configured to be outputting) and also why you choose to have the Component Templates set as Dynamic Templates, when it seems you need their info embedded on the Page?

But looking at your questions:

  1. In Tridion C1 is reported as published, but I can not display it on a page as ComponentPresentation (C1 with CT1). Am I doing something wrong or do I have to publish C1 directly (for example through event system during P1 publishing) to have this working?

  2. When I change C1 and republish C1 directly I would like to have P1 (which calls C20) output changed to reflect this. Is this possible, and if it is, what do I have to do during publishing?

  1. Because CT1 is a Dynamic Component template, it will report C1 to be published, but it will NOT be rendered on the Page, since it is published to your configured storage as a Dynamic Component Presentation, which if you want to display it, you will need to assemble in your Page (using either JSP or ASP.NET code).

  2. Since C1 is not embedded on the Page (it is a DCP), it will not trigger the Page to be republished. If you would make CT20 and CT1 Component Templates which are Embedded on the Page (not dynamic), you would get this behaviour out of the box. If you absolutely need these CT's to be dynamic, then you will need to write an event handler which does this sort of behaviour for you.

All in all, I'm not having enough information to conclude if you are using the wrong type of Component Templates, but at first glance it does seem you are.

Update

You are not necessarily doing something wrong, it is more that you are doing it different. Depending on your requirements you might need to do something else.

Now <tridion:ComponentPresentation runat="server" PageURI="P1" ComponentURI="C20" TemplateURI="CT20"/> is generated in your published Page, because you are using a Dynamic Component Presentation. From this tag I gather you are using ASP.NET in either your Publication Target or your Deployer settings. If that tag is not correctly resolved in your webserver, you are probaly not using an IIS website or your page might not have an ASPX extension (and thus is not recognized as .NET dynamic page).

I would start with:

  1. Unpublishing everything
  2. Changing your Component Templates to be Embedded on the Page
  3. Publish everything again

Only make a Component Template a Dynamic Template if you know what it is and have a specific need for it.

Update 2

So you have a valid use case for Dynamic Component Presentations, and you need to get a DCP rendered from another DCP. If I'm not mistaking thei means you need to use REL as your output language in your Publication Target, since then the <tridion:componentpresentation tag can be resolved. But it also meant you needed to configure the DCP's to be stored on disk and not in the Broker database. But I never bothered too much with that part of the configuration, so you might need to read up on some of its details in the documentation.

For sure you will need to have Dynamic Component Assembly to be configured and setup correctly which also means you need a WAI license on the CD side if I'm not mistaking.

But when you have all that working, you don't need to worry about what happens when you publish C1 or C20. Since each one of these is a Dynamic Component Presentation, so they will be Published to the Broker storage, and the Page doesn;t have to be republished for them to update...

9
  • Hi @Bart, It is possible that I am doing something wrong (not sure what). I have added additional clarifications Commented Sep 22, 2014 at 14:04
  • Hi Bart, Page is working (showing Dynamic CP for CT20). I need both templates to be dynamic and I can not add both of them on the Page level as component presentations. Please see my notes in the original post under "Possible solution: Change CT20 to:". That is the direction I am currently going to... but it looks wrong although it would probably work... Commented Sep 22, 2014 at 14:28
  • There is no need to make the change you suggest, @@RenderComponentPresentation(Field,"CT1")@@ should generate that (provided that CT1 is a valid Component Template ID). But you will need to set your Target Language to REL on your Publication Target. And still you don't give me any information that would validate you need the CTs to be dynamic. So as a solution I would start with the 3 points I give you and proceed from there, I have a feeling you are making everything too complex for yourself from the start... Commented Sep 22, 2014 at 14:44
  • Hi Bart, It seems I am failing to explain what my challenge is. I have give it one more try by updating original question with "Additional information (functional level)" section. Thank you for your patience. Commented Sep 23, 2014 at 10:01
  • Hi Bart, so I need to output <tcdl:ComponentPresentation... from Commercial block for each commercial and to make sure that individual commercials get stored in the broker DB. Tnx. Commented Sep 23, 2014 at 12:03
0

You say that only C20 & C30 are added to the page as component presentations, and C1 is published as a dynamic component presentation.

This means that you will need to add some custom content delivery logic to your outputted page (or somewhere in your web application) to get that C1 component from the broker, and display it to the users.

You state that C20 and C30 call rendercomponentpresentation for C1, but what gets rendered exaclty ? Could you post some sample output of your published page ?

There are some samples on how to work with dynamic component presentations in the tridion documentation on http://sdllivecontent.sdl.com/LiveContent/content/en-US/SDL%20Tridion%20full%20documentation-v1/GUID-7EC91BB9-707C-493D-8AA2-7E6414A307A8 (login needed).

Some more samples can be found on this page https://stackoverflow.com/questions/12799509/how-to-include-dynamic-component-presentation-in-the-tridion-page or here Get Dynamic Component Presentations on the Content Delivery side using the API.

To answer your second question, something like this can be achieved by creating a custom resolver - some code samples can be found as well here : http://www.tridiondeveloper.com/the-story-of-sdl-tridion-2011-custom-resolver-and-the-allowwriteoperationsintemplates-attribute or here : http://www.tridiondeveloper.com/a-custom-resolver-in-practice

6
  • Hi @Harald, Sorry for not being more clear. I will add a more detailed example in the question. Commented Sep 22, 2014 at 12:56
  • could you also specify if a) you get a publish error b) you get an error when opening the page in your browser c) the page renders, but you don't see the C1 component presentation. In the last case, could you post the html that gets published out ? Commented Sep 22, 2014 at 13:01
  • a) I am not getting any errors during publishing b) No errors on the page c) I see C1 as part of C20, but I would like for C1 to be independent of C20 (so when I change C1 in the CM and republish C1 the changes become visible on my P1 page) Commented Sep 22, 2014 at 13:05
  • And can you show the outputted html ? Do you publish your pages as simple .html pages, or as .aspx or .jsp pages ? Could you also add the outputted (published) html to your question ? Commented Sep 22, 2014 at 13:13
  • Additional clarification added Commented Sep 22, 2014 at 14:04

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.