SiteEdit 2009 Essentials - Embedded Components

So you have installed SiteEdit 2009.... what's next? This article contains details on how the basics of SiteEdit 2009 can be implemented in your templates, and then moves on to address additional features such as controlling the publication in which components and pages are edited, making embedded or linked components editable through SiteEdit, and enabling the editing and creation of components that are published as Dynamic Component Presentations. The whole article refers to functionality provided by SiteEdit 2009 SP2. Earlier versions will not necessarily work with the described approaches. The TT72267 hotfix is also required.

SiteEdit 2009 Essentials

Article Sections

The Template Building Blocks mentioned in this article can be downloaded here .

Embedded Components

Depending on your content model, you may have some issues editing components with SiteEdit on your website. This section outlines steps to take if you have component templates that render embedded component presentations (for example if your main component has a component link field, and you render the linked component within your main Component Template).

Altering your templates to handle embedded Components

Often a schema field will link to another component, and in your component template rather than just rendering a link to this component, you want to render some of the field values. This can be done by calling RenderComponentPresentation on the linked component from within your Component Template Dreamweaver Layout.

When you publish such a page with the standard SiteEdit 2009 TBBs, there are some problems:

  1. The Enable SiteEdit 2009 TBB only puts JSON markup around the inner (embedded) CP
  2. SiteEdit shows the inner (embedded) CP with a red border, and makes the component un-editable - as it checks the page in the CMS and doesn't find that component directly on the page, so it thinks that the page contains bad content.

The first problem can be solved by adding the SiteEdit Enclose CP Output with span and JSON TBB just after the DWT in your Main Component Template. This TBB simply adds the enclosing JSON and span tag to the outer CP that is missed by the Enable SiteEdit 2009 TBB.

The second problem can be resolved with the following steps. Essentially we mark the embedded CP as being query based so SiteEdit does not complain:

  1. Prefix the title of the CT used to render the embedded CP with Embed: (eg Embed:Item List) - we do this as a simple way to identify this as an embedded CT.
  2. Update your Outer DWT based on this new name (you don't need to add the :) eg @@RenderComponentPresentation(Component.ID,EmbedItemList)@@
  3. Add the Process Embedded CPs for SiteEdit TBB to your Page Templates  - this takes care that IsQueryBased : false is set to true for CTs which are prefixed Embed:

The first problem can be solved by adding the SiteEdit Enclose CP Output with span and JSON TBB just after the DWT in your Main Component Template. This TBB simply adds the enclosing JSON and span tag to the outer CP that is missed by the Enable SiteEdit 2009 TBB.

The second problem can be resolved with the following steps. Essentially we mark the embedded CP as being query based so SiteEdit does not complain:

  1. Prefix the title of the CT used to render the embedded CP with Embed: (eg Embed:Item List) - we do this as a simple way to identify this as an embedded CT.
  2. Update your Outer DWT based on this new name (you don't need to add the :) eg @@RenderComponentPresentation(Component.ID,EmbedItemList)@@
  3. Add the Process Embedded CPs for SiteEdit TBB to your Page Templates  - this takes care that IsQueryBased : false is set to true for CTs which are prefixed Embed:.

If you render the linked component fields directly, rather than using RenderComponentPresentation, you can use the above method, but you will need to make sure you manually add tcdl:ComponentPresentation syntax around the embedded fields, using a dummy Component Template Uri. If you want the fields to be editable you will need to add tcdl syntax around each field, as RenderComponentField will not work (as it operates on the main component, not the linked one)