I am trying to render a particular Dreamweaver component template. can anyone help me with the script to display a particular component presentation.

  • How are you going to define "particular component presentation"? Is it TCM URIs of component and template or is it one of the cps that are on the page? Jul 15, 2015 at 14:51
  • one of the cps on the page Jul 15, 2015 at 15:00
  • What do you know that determines if the CP is the one to render? A unique Schema, Component Template, Order, TCMID? Jul 15, 2015 at 15:56

3 Answers 3


You can use the following built in function if you know the Component and Component Template ID

RenderComponentPresentation(string componentUri, string templateUri)

Your DWT syntax would look like

@@RenderComponentPresentation("tcm:x-y-z", "tcm:x-y-z")@@

However, be careful moving between environments as these ID's will change.

  • I tried with tcm numbers but it shows a javascript error "Expected ',' or ')'". even with the quotes to tcm numbers Jul 15, 2015 at 17:47
  • Add your line of code to your question to help people help you. Jul 15, 2015 at 17:48
  • This is what I have used.<!-- TemplateBeginRepeat name="Components" --> @@RenderComponentPresentation(string "tcm:7-667494", string "tcm:7-667495-2048")@@ <!-- TemplateEndRepeat --> Jul 15, 2015 at 17:51
  • First, see my update above. You do not need the "string" text. Secondly, in your code above you are looping all CPs and writing out the same one everytime. Is that the desired output? Jul 15, 2015 at 17:53
  • It worked. Thank you so much. "@@RenderComponentPresentation("tcm of component","tcm of template")@@"" Jul 15, 2015 at 18:09

Assuming you want to render a component presentation on a PT.

To render a component presentation selectively, you need a way to identify it. If you want to do it based on the component title, you can do it like below:

 <!-- TemplateBeginRepeat name="Components" -->
   <!-- TemplateBeginIf cond="Component.Title == '[Insert Component Title]'" -->

    <!-- TemplateEndIf -->

<!-- TemplateEndRepeat -->

Read more about the Dreamweaver Templating here

  • This is the error I got, "Optional region does not have a 'cond' parameter specified". My CP name is "LeftMenu CTBB" does the space matter? Jul 15, 2015 at 16:58
  • try replacing "Cond" with "cond", I guess capital "C" should be the culprit. Jul 15, 2015 at 17:04
  • No error, but It did not show the content Jul 15, 2015 at 17:31
  • are you using the above code on "Page Template" ?? Jul 15, 2015 at 17:38
  • yes. I am using it on the page template Jul 15, 2015 at 17:48

If you want to render all components using a given template you can use Will Price's Group Components By Template Type TBB found here: https://sdltridionworld.com/community/2011_extensions/generic-2011-tbbs.aspx

This will group all components using the same templates onto an array on your package which you can iterate over using:

            <!-- TemplateBeginIf cond="[Insert Template Name]Components" -->
                <!-- TemplateBeginRepeat name="[Insert Template Name]Components" -->
                <!-- TemplateEndRepeat -->
            <!-- TemplateEndIf -->

Will's code is well commented and includes more details on how it can be used.

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.