Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I use tcdl, Tridion tag, or RenderComponentPresentation?

Managing a "Global" Logo with Tridion

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:

  1. Logo as a Component--image as a multimedia (mm) component and link, alt (i.e. "home"), and other text in an optional container component
  2. Dynamic Component Presentation (DCP)--ability to manage logo's markup presentation and publish changes without requiring publishing every page
  3. Share-able--ability to localize multimedia and text in components, rather than templates, in lower publications

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.

Question(s):

  1. 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?

  2. 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.

like image 368
Alvin Reyes Avatar asked Oct 06 '22 13:10

Alvin Reyes


1 Answers

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.

like image 181
Bart Koopman Avatar answered Oct 21 '22 09:10

Bart Koopman