0

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
3
  • I think your error might be in the Component Template, not in the Page Template. All the Page Template is asking for is for a Component Presentation to be rendered, and it seems that the Component Template is the one with an error in it (maybe trying to render a Field collection which is empty, hence the "Length cannot be less than zero." error). – Nuno Linhares Mar 12 '14 at 14:34
  • And yes, it is a duplicate. This one was migrated from SO. I'll flag it to be closed – Nuno Linhares Mar 12 '14 at 14:35
  • there is no error in component template its working fine when the page template is using the following code by using the source template type as VBScript, [% For Each lObjCP In Page.ComponentPresentations WriteOut lObjCP.Content Next %] 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:42

Browse other questions tagged or ask your own question.