Monday, September 26, 2011

Pushing Component Presentations into the Package

When you use a .NET TBB to create a Component Presentations array, use the ComponentArray Package Item ContentType, rather than the expected ComponentPresentationsArray type:
Item pageRegionCPsItem = this.m_Package.CreateStringItem(ContentType.ComponentArray, ComponentPresentationList.ToXml(regionCPs));
this.m_Package.PushItem(String.Concat(this.itemNamePrefix, "_ComponentPresentations"), pageRegionCPsItem);
<!-- TemplateBeginRepeat name="MiddleTile_ComponentPresentations" -->
    @@RenderComponentPresentation()@@
<!-- TemplateEndRepeat -->
When you do use the ComponentPresentationsArray then either only the first element is rendered, or none at all.

No comments: