Return to doc.sitecore.com

Documentation

 

1.  Description

The FieldViewer is an XSL rendering that displays content of one Sitecore field. The way the field is rendered depends on the field’s type. For example, if the field is of the "image" type, it’s rendered as an image; if the field is of the "link" type, it is displayed as a  link. It is possible to further customize the FieldViewer XSL Rendering via its parameters.  

Please refer to the XSL section for more information about creating XSL renderings.

 

2.  Installation guide

The XSL FieldViewer rendering is distributed as a standard Sitecore package; hence in order to start using it, you should install the package. Please refer to the 'Installing Modules and Packages' article if you are not familiar with the standard Sitecore Packager tool.  

After the package installation, you will see the XSL FieldViewer rendering in the list of XSL renderings.  

Thus you will be able to place it on a (sub)layout or tie via placeholder like any usual rendering.

 

3.  User Manual

The FieldViewer is an XSL rendering, thus you can work with it like with any other XSL rendering.

The FieldViewer XSL rendering is adjusted via several parameters.  

Open the Parameters tab of the rendering (double-click on the rendering) and set properties as described in the example below.  

You can also define the properties in the xslSimpleMenu rendering (see <!--parameter --> section in the rendering’s source code).

 

 

Valid Parameters

 

DateFormat

Property value:

The format string for the date/time field type. The default value is "D".

Remarks:

The property is used only if the displayed field is of the "date" or "datetime" type.

The format string should contain either a format specifier character or a custom format pattern. For more information, see the summary page for System.Globalization.DateTimeFormatInfo.

 

ImageFormat

Property value:

The format string for image fields. The default value is "<img src='{0}' border='0' alt='{3}'/>"

Remarks:

The property is used only if the displayed field is of the "image" type. The ImageFormat property allows you to customize the HTML code generated for the image. By using the ImageFormat property, you can include/omit certain attributes specified for the image in the Media Library. The format string is similar to that of the System.String.Format function

 

The format Items are replaced with the following attributes from the Media Library:  

By default, only "src" and "alt" attributes specified for image in the Media Library are used.

 

LinkFormat

Property value:

The format string for the link. The default value is "<a href='{0}' target='{2}'>{1}</a>"

Remarks:

The property is used only if the displayed field is of the "link" type. The LinkFormat property allows you to customize the HTML code generated for the link. By using the LinkFormat property, you can include/omit certain attributes that were specified for the link in the SiteCore editor. The format string is similar to that of the System.String.Format function.

The format Items are replaced with the following link attributes:  

By default, only "url", "text" and "target" properties specified for the link in the Sitecore «Insert link» dialog box are used.

 

FieldName

Property value:

The name of the field to be displayed by the FieldViewer XSL Rendering.