To manage, for example, a website-wide logo and its text elements with SDL Tridion, I'd want it in a component, rendered by a (dynamic) component template, and placed by page templates. My requirements would include:
Authors shouldn't need to place the logo as a component presentation (CP) on every page, although a logo CP just on the homepage could offer dynamic linking.
RenderComponentPresentation()
, TCDL
, or Tridion
tags for "Non CPs"For this CP-less approach, I think RenderComponentPresentation() or TCDL tag would be the right "agnostic" approach. Is one preferred over the other?
For example, my template outputs:
<h3>By tridion: (ASP.NET) tag</h3>
<tridion:ComponentPresentation runat="server"
PageURI="tcm:7-1535-64"
ComponentURI="tcm:7-1533"
TemplateURI="tcm:7-1532-32"/>
<h3>By tcdl: tag</h3>
<tcdl:ComponentPresentation
PageURI="@@Page.ID@@"
type="Dynamic"
ComponentURI="tcm:7-1533"
TemplateURI="tcm:7-1532-32"/>
<h3>by render component presentation</h3>
@@RenderComponentPresentation('tcm:7-1533','tcm:7-1532-32')@@
These get transformed to the following on the file system.
<h3>By tridion: (ASP.NET) tag</h3>
<tridion:ComponentPresentation runat="server"
PageURI="tcm:7-1535-64"
ComponentURI="tcm:7-1533"
TemplateURI="tcm:7-1532-32"/>
<h3>By tcdl: tag</h3>
<tridion:ComponentPresentation runat="server"
PageURI="tcm:7-1535-64"
ComponentURI="tcm:7-1533"
TemplateURI="tcm:7-1532-32"/>
<h3>by render component presentation</h3>
<tridion:ComponentPresentation runat="server"
PageURI="tcm:7-1535-64"
ComponentURI="tcm:7-1533"
TemplateURI="tcm:7-1532-32"/>
Each renders delivery-side so the user sees the correct CP in the browser.
Any approach gets us a DCP referenced from a PT with an agnostic format that gets retrieved presentation-side, avoiding full-site publishing. It's not really on the page so we have to be sure to publish the logo with a dynamic CT (it's html fragment in this case). Am I missing anything?
Is RenderComponentPresentation() preferred over TCDL or a specific presentation-side syntax? Any reason I'd actually want <tridion:ComponentPresentation runat="server">
instead?
Edit: I was missing the Type="Dynamic"
attribute and value, also for a moment thought RenderComponentPresentation didn't create the right CP reference.
Basically you have answered your first question yourself already I think, apart from how you want to write it out in your template you have your DCP there.
My preference would be to use @@RenderComponentPresentation('tcm:7-1533','tcm:7-1532-32')@@
but I would actually not use it with hardcoded TCMURIs. I'd probabaly write a TBB which reads the Multimedia Component TCMURI and its Template URI somewhere from for instance a configuration Component or the Publication metadata, then your template could look something like:
@@RenderComponentPresentation(${LogoUri}, ${LogoTemplateUri})@@
When using Dreamwever TBBs for your layout, I would use this as a preference. If you are using another way of layout, then the next best thing would be to use the TCDL tag. Indeed to try and keep your templates code agnostic. The only time I would ever revert to writing out the tridion control code myself, is when I cannot get it there another way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With