How to retrieve the component presentation using DWT in a Page Template where the component have neither content nor any fields in it.The component is a dummy component created using empty schema linked along with a component template on a page. I tried the following DWT code

 <!-- TemplateBeginRepeat name="Components" --> 
 <!-- TemplateEndRepeat -->

But I am getting the following error while running the page template in template builder..

Length cannot be less than zero.
Parameter name: length
   at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
   at Tridion.ContentManager.Templating.Dreamweaver.DreamweaverMediator.TransformValueReferences(Package package, StringReference templateReference, Regex startTagExpression, String endTag)
   at Tridion.ContentManager.Templating.Dreamweaver.DreamweaverMediator.TransformRegions(Package package, String dreamweaverTemplate)
   at Tridion.ContentManager.Templating.Dreamweaver.DreamweaverMediator.Transform(Engine engine, Template templateToTransform, Package package
  • 2
    It could be an error in your component template - what TBBs are you using for this?
    – Will Price
    Mar 12, 2014 at 14:15
  • i am using the component template with template type as VBScrip[Legacy] . when the page template is using the following code with template type as VBScript, [% For Each lObjCP In Page.ComponentPresentations WriteOut lObjCP.Content Next %] i dont get any issue. But when i am converting this page template into a compound template with a dreamweaver tbb in which i am trying to retrieve the component presentations , i am facing an issue – Mar 12, 2014 at 15:50
  • 1
    To Will's point, do you get this error on a particular TBB or upon start of execution of the template? If the error is on the DWT TBB, then run each Component Template you use of the Page separately in TemplateBuilder and see if any of those error out individually. Also, did you try restarting TemplateBuilder? Also give the COM+ service on the CM server a swift kick (reboot). Mar 12, 2014 at 19:19
  • Can you open this Page Template in the Template Builder and then run it with the Page it fails on? Then you will see where it fails and also have direct access to the log, perhaps that gives you more information. Else you can add a screenshot of the error in the Template Builder to this question and add the output of the log so we have more information to work with. Mar 13, 2014 at 10:12
  • Can you try to convert the CT to a compound CT as well instead of VBScript, or is that too much work? Mar 13, 2014 at 17:45

1 Answer 1


Have you add Extract components from Page TBB before your DWT? Extract components from Page tbb will create "Components" package for you...

  • That is not a strict requirement, the Page is the default item in the Package, and that will allow access to the Component Presentations (via the Components keyword). I know it is often explained (and also documented) that this TBB is required (it is also part of the Default Page Template), but it is not needed for simply rendering all Component Presentations on a Page (I never used it on any of my Templates and they all work, with the exact same DWT as the OP is using). Mar 13, 2014 at 10:06

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.