1

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" --> 
 @@RenderComponentPresentation()@@
 <!-- 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 '14 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 – – user3113876 Mar 12 '14 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). – Nickoli Roussakov Mar 12 '14 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. – Bart Koopman Mar 13 '14 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? – Philippe Conil Mar 13 '14 at 17:45
0

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). – Bart Koopman Mar 13 '14 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.