Replacing RenderComponentField() calls in your templates

Use this task to replace your deprecated RenderComponentField() calls with calls to the new methods, FieldStartMarker(), FieldEndMarker(), FieldValueStartMarker() and FieldValueEndMarker().

About this task

Although the RenderComponentField() method remains supported in templates, it is deprecated.

To benefit from improvements in templating (specifically for the SDL Tridion 2013 SP1 HR1 release, the ability to add, remove and move embedded fields in Experience Manager), replace your RenderComponentField().

Procedure

  1. In Adobe Dreamweaver or a text editor of your choice, open a Template Building Block that contains one or more RenderComponentField() calls.
  2. In the location of the RenderComponentField() call, write the following:
    @@FieldStartMarker(FIELDNAME)@@
    @@FieldEndMarker()@@

    where FIELDNAME is the name of the field you want to display, either the actual name enclosed in double quotes or a variable. FIELDNAME may refer to a subfield of an embedded field (for example, "Address.Street") or to a metadata field ("Metadata.Editor").

  3. If this is a multivalue field over whose values you wish to iterate, add the following inside your new code block:
    <!-- TemplateBeginRepeat Name="FIELDNAME" -->
    <!-- TemplateEndRepeat -->

    where FIELDNAME is the name of the field you want to display, enclosed in quotes, either the actual name enclosed or a variable enclosed in variable delimiters (either ${ and } or @@ and @@.

  4. Inside your current code block, enter one of the following:
    • If you are rendering a single-value field:

      @@FieldValueStartMarker()@@
        @@GetFieldValue(FIELDNAME, 0)@@
      @@FieldValueEndMarker()@@
    • If you are iterating over a multivalue field:

      @@FieldValueStartMarker(TemplateRepeatIndex)@@
        @@GetFieldValue(FIELDNAME, TemplateRepeatIndex)@@
      @@FieldValueEndMarker()@@
    • If you are rendering one specific value of a multivalue field (say, the fourth field):

      @@FieldValueStartMarker(3)@@
        @@GetFieldValue(FIELDNAME, 3)@@
      @@FieldValueEndMarker()@@

    where FIELDNAME is the name of the field you want to display, either the actual name enclosed in double quotes or a variable.

  5. Save and close your Template Building Block.
  6. In Content Manager Explorer, use the Where Used functionality to find out which Templates use this Template Building Block.
  7. Republish all Templates that use this Template Building Block.
  8. Find another Template Building Block that contains RenderComponentField() calls, and change it in the same way. Continue until all your Template Building Blocks have been updated.