| ProfileSitecore APIBlogLists | Help |
|
|
December 06 Linking items and databasesThe following will apply to the release build of Sitecore 5.1.1
In Sitecore you can create special 'proxy' items that serve as links between different items. The items being linked may come from different databases.
For instance, say I have the following structure:
A
|-B |-C |-D |-E |-F Now I want to expose E and its children below B such that E can be found both below B and below C. The way to do it is:
E will now appear below B and its data and children will be shown when it is selected. The E below B is shown in a different color to signify that it is only a 'shadow' of the real E.
A
|-B |-E' |-F' |-C |-D |-E |-F All operations on the E shadow item (E') will be redirected to the real E. For instance if you change any data in E' and select Save then the data will be saved to E. E' has no data of its own.
Even the Delete operation works on the real E so be careful!
There are a few exceptions to the rule of redirection:
Linking across databasesTo make links between databases, follow the same instructions as above, but specify a database name in the 'Target database' field of the proxy item. When proxies are activated, the shadow items will be retrieved from the target database.
Please note that to protect the host database, all shadow items will be given unique (but static) IDs. Therefore you can link the same items multiple times in the same host database without ID collisions.
ChildrenIt is possible to exclude the children of a linked item by selecting 'Exclude children' on the proxy item.
API support for linked itemsThe shadow ID will be exposed in the Item.ID property. If you need the 'real' ID of an item, you can use:
Item.InnerData.Definition.ID
Also, there are some properties in the RuntimeSettings object that supports working with linked items. Note that the settings only applies when proxies are activated.
In a future version we will expose more of the 'shadow' API.
|
|
|