What are Presentations in Sitecore

How a page is resolved in Sitecore

A user typically hit the website using a url as, http://learning/news

in Sitecore a URL always point to a particular item, which has the rendering details bind on it. Thus while calling an item via URL, the presentation details present over the item tell Sitecore what response it has to send to the requester.

Clearly, the layout engine applies logic and merges predefined markup and logic in the presentation components that you implement with content from the CMS. Detailed flow how request flows within Sitecore system –

Above cycle execute only when a particular item is request from the Web Browser. So its the presentation detail of an item which decided the appearance of the item (i.e., HTML tags). Sitecore defines a processing context for each HTTP request. The Sitecore context contains
information about the user, the requested item, the requesting device, the managed site, and other information associated with the current HTTP request. For each HTTP request, Sitecore invokes the httpRequestBegin pipeline, which is largely responsible for populating the
Sitecore context.

Important static properties of the Sitecore context –

  1. Database — Sitecore database associated with the current request, or default database for the context site.
  2. Device — Sitecore device associated with the current request, or default device for the context site.
  3. Domain — Sitecore security domain associated with the context site.
  4. Item — Item in the context database requested by the web client (based on the path in the requested URL).
  5. Items — Keyed collection of values available throughout the HTTP request life-cycle
  6. RawURL — Original URL requested by the web client before any modifications by Sitecore.
  7. Site — Managed site associated with the current request.
  8. User — Authenticated user, or anonymous user in the context security domain.

LAYOUT DETAILS AND LAYOUT DELTAS

Layout details define the presentation components that Sitecore should apply dynamically to render an item for a specific type of web client, such as a browser or mobile device. Layout deltas allow items to inherit layout details from other items (including standard values), storing only the differences between those inherited layout details and the layout details you define in the item, so that you can override individual presentation components as needed.

Define layout details in the standard values for each data template, and avoid defining layout details in individual items. If you need to override the layout details defined in a data template, create a new data template that inherits from the existing base template and apply new standard values for that data template.

PRESENTATION COMPONENTS

Below are the list of components used by the layout engine to create a page (or resource) requested –

  1. Devices
  2. Layouts
  3. Placeholders and Placeholder Settings
  4. Presentation Controls (Renderings)

1. Devices

Sitecore devices are logical constructs that allow Sitecore to apply different presentation components to a content item depending on aspects of the HTTP request, it determines who has called the request. For each HTTP request, the DeviceResolver processor in the httpRequestBegin pipeline determines the context device from the sc_device query string parameter (which can specify the name of
a device), by matching query string parameters against values in device definition items, by matching the user agent transmitted by the browser against values in device definition items, or from attributes of the context site. The default devices are as follows-

  • Default — Typically represents web browsers; applies to HTTP requests that do not trigger a specific device.
  • Print— Triggered by the query string parameter p=1; represents a printer.
  • Feed — Represents RSS readers.

You can register any number of additional devices, such as one for mobile phones and another for tablets.

2. Layouts

Sitecore layouts are ASP.NET Web Forms (.aspx files) /mvc views (.cshtml files) that define a markup superstructure typically shared to a number of pages. Layouts are generally the most reusable presentation component. The presentation controls can be bind to the layout statically, programmatically, to placeholders dynamically.

3. Placeholders and Placeholder Settings

Sitecore placeholders are ASP.NET controls to which you can dynamically bind presentation controls using layout details. You must define a key for each placeholder, as the presentation gets bind to the placeholder via its key. For each placeholder key that you implement, create a placeholder settings definition item under the /sitecore/layout/Placeholder Settings item using the System/Layout/Placeholder data template. The Data section of placeholder settings definition items contains the following fields:

  • Placeholder Key — Key of the placeholder for which these settings apply.
  • Allowed Controls — Presentation controls the user is allowed to bind to the placeholder.
  • Description — Information relevant to users interested in binding controls to the placeholder, which can include a graphic that indicates the location of the placeholder on the page.

4. Presentation Controls (Renderings)

Below are the list of rendering available for creating items appearance –

  1. Sublayouts
  2. XSL Renderings
  3. Method Renderings
  4. URL Renderings
  5. Web Controls
  6. Rendering Parameters and Rendering Parameters Templates

 

 

3960cookie-checkWhat are Presentations in Sitecore

Add a Comment

Your email address will not be published. Required fields are marked *