Thursday, February 18, 2010

Enterprise CMS in the Hands of Masters

When I think of Enterprise CMS implementation – particularly the most complex implementations out there – Revere Group always sits at the top of my list. You might think that – as a billion-dollar company – they would be slow-moving, bureaucratic and lacking spark. I can promise you that nothing could be further from the truth. It’s no coincidence that within a month Sitecore recognized this organization three times – for the Best Legal Site of the Year, as a Sitecore MVP and as a Sitecore Outstanding Solution recognized partner. They are that good.

As part of their Outstanding Solution submission, they showed me something I literally didn’t even know existed. It’s so cool, I can’t believe no one has thought of it before. But it’s true. I’ve trained hundreds of Sitecore developers and seen at least as many support cases; but I’ve never seen one tackle an implementation challenge with this particular trick.

Here’s the challenge: If you’ve been working with Sitecore for awhile you know that one of the tricks for content sharing is the idea of having a pointer item. A pointer item has a drop-list that points to another item in the content tree. It may also have fields that resemble the referenced item. For example, an item may have the following fields:

  • Title
  • Description
  • Image
  • Reference Item

The Reference Item field is a drop-list that points to another item (typically containing similar fields). In your presentation components, you can use the following logic:

  1. Retrieve the Reference Item.
  2. If Title is null in the context item, use the Title field from the Reference Item
  3. If Description is null in the context item, use the Description field from the Reference Item.
  4. If Image is null in the context item, use the Image field of the Reference Item.

I’ve also described this approach in my Content Tree blog. The idea is cool, but it does require a little bit of coding in your presentation components to figure out whether to get the data from the current item or from the reference item.

Revere and, in particular, Sitecore MVP Matt Hovany, came up with an ingenious simplification of the problem. Looking in the Sitecore web.config, Matt found that Sitecore defines a Standard Values provider (see below).

StandardValuesProvider

Matt decided to extend this provider to incorporate the concept of a reference item. In the example above, the Reference Item is treated as the current item’s Standard Values. By using a Standard Values provider, Matt got all of the logic he needed built-in.

Think about the above example again. Instead of having to use presentation logic to figure out whether to use the field values from the current item or the reference item, Matt coded a Standard Values provider that did all of the work in one place. Because the referenced item is treated like the current item’s standard values, there is no longer any need to place this logic in your presentation components. It works automatically, just like normal Standard Values in Sitecore.

This qualified as an Outstanding Solution in my mind because I heretofore had not encountered such an elegant solution to a common implementation challenge in Sitecore. You’ll be hearing more about Revere Group’s innovations in later Outstanding Solution blog posts.

2 comments:

  1. Extending the provider. Makes sense. Can you comment on the reason you would implement a reference item and benefits of doing so?

    ReplyDelete
  2. Hi Eric,

    Reference items are one approach you can use when sharing content within a site or across sites. See here for more information:

    http://contenttree.blogspot.com/2008/01/proxy-items-and-reference-items.html

    You may also be interested in the Content Reuse doc in the References section of the SDN site.

    Best wishes,
    Derek

    ReplyDelete