Return to doc.sitecore.com

Valid for Sitecore 5.3
Using Proxy Items in Sitecore 5.3

Sitecore 5.3 introduced a number of changes associated with Proxy Items.  This article describes these changes in detail.
For information on using proxies in versions of Sitecore CMS prior to 5.3 see the following article.

Using Proxy items in Sitecore 5.1.1

1.  What is a Proxy Item?

 
Proxyn. A person authorized to act for another; an agent or substitute.

In Sitecore 5.3, when proxy items are enabled, a proxy item instructs Sitecore to generate a virtual item, which acts as though it is the source item, but is displayed in a different location. Virtual items are displayed in the Content Editor content tree with grey text, as shown in the image to the right.

Proxy items make it possible to show a source item (and potentially its children) in multiple places within the Sitecore content tree.  Changes to virtual items are reflected immediately in the source item.  Even deleting a virtual item or sub-item deletes the same item at the source. 

Proxy items are defined in the /sitecore/system/Proxies folder and specify a source item, the target item or parent to the virtual items generated, whether sub-items of the source should also appear as virtual items, and the database from which to retrieve the source item.

/upload/sdn5/articles 2/administration/proxy_5_3/proxy02.jpg

2.  Proxy Template

Proxy items are based on the /sitecore/templates/system/Proxy template.  The Proxy template includes fields which configure how the proxy works.  These include:

3.  Creating a Proxy Item

This section describes the steps required to create Proxy Items. 

  1. Log in to the Sitecore Content Editor client as an Administrator user.
     
  2. Open the Content Editor.
     
  3. Locate the /sitecore/system/Proxies folder.  Right click on the folder and select the New » Add from Template… popup menu command. 

    /upload/sdn5/articles 2/administration/proxy_5_3/proxy03.jpg 
     
  4. Select the System » Proxy template and then click Open

    /upload/sdn5/articles 2/administration/proxy_5_3/proxy04.jpg 
     
  5. Provide a name for the proxy item. 
     
  6. Specify values for the source and target items, and indicate whether Sitecore should exclude subitems. 

    If you want to reference a source item in another database, specify the name of the database.
     
  7.  If this is the first proxy you have created, you must configure the appropriate databases to support proxy items.  Please refer to the next section.

4.  Required Configuration

You must enable proxy items in the Sitecore web.config file. 

Each database may have its own proxy settings, which are included as sub-elements in the database element (for example, as sub-elements under the <database id="master"...> element).

Unlike previous releases, proxies are NOT enabled by default.  Please be aware that enabling proxies has a negative effect on the performance of the entire site.  Enable proxies only if they will be used. 

Sitecore includes the following configuration settings:

It's very important that the proxy settings for the master database and publishing target are compatible.  For instance, in a standard Sitecore installation, there are two valid cases:

  1. Only proxy definitions published.

    <!-- master -->

    <database id="master"...

      ...

      <proxiesEnabled>true</proxiesEnabled>

      <publishVirtualItems>false</publishVirtualItems>

     ...

    </database>

    <!-- web -->

    <database id="web"...

      ...

      <proxiesEnabled>true</proxiesEnabled>

     ...

    </database>

  2. Virtual items published.

    <!-- master -->

    <database id="master"...

      ...

      <proxiesEnabled>true</proxiesEnabled>

      <publishVirtualItems>true</publishVirtualItems>

     ...

    </database>

    <!-- web -->

    <database id="web"...

      ...

      <proxiesEnabled>false</proxiesEnabled>

     ...

    </database>

5.  Proxy Items in the API

When accessing items via the Sitecore API, the Item.ID property of virtual items will contain the ID of the virtual item, not the source item.  That is, virtual items all have their own unique ID.  Virtual IDs are persistent, however, so they can be used like any other ID.  To access the ID of the source item from a virtual item, use:

Item.InnerData.Definition.ID

The RuntimeSettings object includes some properties associated with using Proxy Items (these settings only apply when Proxies are activated):  

It is also possible to enable and disable proxies programmatically.

6.  Installing Proxy Items

This section is currently under construction.  Please check back later.