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

Wednesday, September 30, 2009

Using Parameter Templates in renderings

This is my first serious attempt at writing something helpfull, so I hope it will be well recieved ;)
A new feature introduced in Sitecore makes it possible to create a data template and use the fields of this template as predefined parameter names for rendering! Personally I like this very much. But how does it work?

For example consider a rendering for a top 5 songs list. That song list can be added on different pages through the page designer by the editors, but they want to be able to choose the genre of the songs that should be shown (rock, pop, country etc.).

Before this we could only add custom parameters to renderings where they were used by both typing parameter name and value, which is not very userfriendly (The editor would have to remember both Parameter name and the allowed values):



When Using Parameter templates the above properties window looks like this instead:



In the above example I have used a Parameter template with three fields, a text field, a checkbox field and a multilist field to show different types of fields can be used.

So How do we make this happen. Very easy:
Create a normal template

Make sure that the template inhirits from the standard template and the System/Layout/Rendering Parameters/Standard Rendering Parameters template. That's what makes the magic happen!

Create the rendering where the Parameter template is needed

Click on the rendering definition item and find the field called "parameters Template" and choose the template.



And voila, it all works!!

Comments about usefullness etc. is very welcome!

Tuesday, September 29, 2009

Yet another Sitecore Blog

This is my first attempt at blogging so be gentle!

This blog will mostly be about Sitecore. Not the hardcore technical stuff, but new functions/features and tips and tricks (if I can find any that hasn't been blogged already).

I am working for Sitecore so my blogging will be biased! Now you are warned ;)