Tuesday, December 22, 2009

The importance of the Data Source attribute

I know that most of you probably already know the importance of actively using the data source attribute on renderings. This has become even more important with the Online Marketing Suite.

So if you are new to Sitecore or just haven't thought about using the data source yet, read on.

I am going to use the Nicam site as an example and show how we can use the same control to output different content based on the source attribute.

In the right hand image there is a control outputting the text "D3X" on a red background with a link to the D3X page. The content item that holds the information for the control is not the current context item, but rather an item that the developer has pointed to when chosen to output that control on this specific page.









The content item looks like this:


Now to change the content I could just change the values of the content item, but if I have used the "D3X - red" content item on other pages and wants to keep the content it would be smarter to use the data source attribute to point to another content item like the one above "D3X - grey".

This way I can reuse the same control over and over on different pages (or on the same page) but change the actual content by pointing to different content items through the data source attribute.

The data source attribute is found in the "Layout Details" when clicking on a control or in Design mode when highlighting a control and then clicking on properties.

Setting the data source attribute actually means that you point to a different "context" item than the one requested by the URL. So you don't need to specify anything when extracting content from a field.

for example outputting the text from a single line text field would just be:

<sc:text field="field name">

Because omitting the "select" statement means that Sitecore will use the context item.

Online Marketing Suite
Creating controls that uses the source attribute is especially important when using the OMS for personalization or multi variant testing.

This is because the Personalization rules and MV testing both uses the data source to change the content item displayed through a control based on the rules that the user set up.

Drop me a comment if you want more info about using the data source when setting up MV testing or personalization rules.

Tuesday, December 1, 2009

New icons in Sitecore 6.2

Just a quick post about the new Icons in Sitecore 6.2.

The new icons is actually just an update of the old ones to have a more Windows 7/Vista look (see small sample below).



They can be found in the Website\sitecore\shell\Themes\Standard folder as zip files together with the old icons. The icon folders have the same names as the old ones just with "V2" appended.

But when you want to use the new icons for example for a template they are not visible in the icon selector. You will still see the old ones!

To use the new ones instead of the old, rename the zip archives of the old icon zip folders to something else and then unzip the "V2" zip archives, delete the V2 from the folder name and re-zip the folder.

Now you should see the new icons