Thursday, January 21, 2010

Sitecore Presentation Controls

In Sitecore, there are various web controls that can be used to display the value of a field. This is critical because content it stored in fields. If you want to display the date assigned to a press release or an image of the cover of a book that you sell on your website, this is what you are interested in.

However, presentation logic should be thought of as more than a bunch of individual values. There are relationships between the fields being displayed. You're not just displaying the title of a book along with its cover. You are displaying details about a book. Today it's the title and cover. Tomorrow it might also include a summary of the book.

Before presentation controls and after.

A block of presentation logic in Sitecore is defined using a component called a "presentation control". In this post I am going to give a quick overview of presentation controls.

What is a presentation control?
A presentation control allows presentation logic to be defined in a reusable component. Some examples are:
  • Book detail - displays the title, author, summary and price of a book along with an image of its cover, positioned in a certain way
  • Breadcrumb trail
  • Ad block - displays an image and a hyperlink
  • Header block - displays an image, search box, an ad block and a home link
Sitecore supports 3 kinds of presentation controls: sublayouts, webcontrols and renderings. Sublayouts and webcontrols are written using .NET. Renderings are written using XSLT.

What are the benefits to presentation controls?
One benefit of using presentation controls is that your presentation logic is encapsulated in a reusable component.

Another benefit is that content editors are able to use the Sitecore page editor to drop presentation controls into their web pages. This is a very powerful tool that can be offered to content editors, and one that I will cover in a future post.

This is not so much a benefit of presentation controls so much as a benefit of Sitecore. There is no new, proprietary technology that you need to learn in order to create presentation controls. You can use .NET or XSLT.

I spent many years teaching people how to use a product that depended on an unwieldy, proprietary language for presentation logic. It's definitely to Sitecore's credit - and the benefit of people learning Sitecore - that they decided against reinventing the wheel.

What's next?
My next post will take a look at some of the technical details of presentation controls. How are they written? What do they look like? How are they used?

Want to learn more?

1 comment:

  1. Sublayout = ASP.NET User Control
    Webcontrol = .Net server control class that inherits from Sitecore.Web.UI.Webcontrol

    Thanks for your post.


Note: Only a member of this blog may post a comment.