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.
- P1 has C20-CT20 and calls RenderComponentPresentation():
- C20 calls RenderComponentPresentation(C1,CT1)
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?
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?
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:
- CT1 (which renders C1) is "Published as Dynamic Component", "Output format: REL"
- CT20 (which renders C2) is "Published as Dynamic Component", "Output format: REL"
- 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"/>
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.