Return to doc.sitecore.com

1.  Overview
Prev Next

In order to separate content from presentation, media items such as Flash, video and images are generally not referenced in HTML fields but in fields specifically provided to store such references.  Rendering logic then assembles the media into the content when generating the page.

Sitecore media items store metadata about files in subdirectories starting from the folder specified in the MediaFolder setting of /web.config (/upload by default). The most important field in a media item is the path field which specifies the file system folder path to the binary relative to the document root.

If all content items of a given type (template) can reference only one media asset, such as a Flash banner to include at the top of the page, then a simple selection field can be used to reference the asset.  If each content item of a given type (template) can reference any number of media assets, such as a list of images to include in a photo gallery page, a selection field supporting multiple items can be used (generally multilist or treelist).

The Source Property

Every field definition in a template contains an optional Source property (see the entries under http://sdn.sitecore.net/Reference/Field%20Reference/Standard%20Data%20Types.html for details).  For HTML fields Source defines the path to an HTML editor profile controlling which features are exposed in the UI for that field.  Most of the selection field types allow a full Sitecore path to be specified in the Source property, for instance for instance “/sitecore/media library”; children (not all descendants) of the specified item (“/sitecore/media library/*”) will be included in the selector.  Some selection field types support Sitecore’s query syntax, for instance “query:/sitecore/media library//*[@@templatekey = 'file']” to list all descendants of “/sitecore/media library” which are based on the template named file.  For some field types such as Image and File the Source property defines the root of the tree from which the selection can be made; for instance an Image field with Source set to “/sitecore/media library/images” will not allow the user to select a media item stored under a different path.


Prev Next