Tag: Extensions

Sitecore Layout Comparer Extension Classes

February 21, 2011

So during a project where I was converting a site to new templates for a rebuild, I was automating the creation of the new items and needed to know if the current page had any layout overrides on the item. It was necessary for me to compare each page's layout definition against the layout definition assigned to its standard value. If you've never ventured into the standard fields let alone the raw values of an item you might find this useful. The layout fields are stored as xml and keep references to all devices, sublayouts and layouts assigned to it. I ended up writing a few classes that handles the comparisons. It's not something that's entirely common but occassionally you need to know how to deal with the layouts programmatically. Hopefully someone else will find it useful too.