In this article we will show you how to design your first Data template. A  Data template is a representation of the data you want to see on screen.

First lets start by logging into sitecore via Content Editor mode. Content Editor is where you will be spending most of your time developing websites.

After you login you should see the  following screen.

Navigate to the User Defined section under Templates. Lets create a Template folder  by clicking on the “Template Folder” icon. Give a name of “DemoData”.

Next we will create a Template and Give it name called “SamplePage”.

Select the location to be the DemoData folder we previously created.
You now you have base template that you can start adding fields to. You can group your fields by section, this is mostly for you to organize and group data it is not  how you retrieve your data. Lets create a section called header. Under it give it a field called Title and select SingleLine Text field from the options in the dropdown. Continue and add a field called MetaDescription and select MultiLine Text field from the options in the dropdown. Lets add another section called Content, in this section add a field called Body and select Rich Text field from the optin in the dropdown. You should have something that look like the screenshot below.

Next we have to do one of the most important things, and the easiest step to forget. We have to add the standard values to the the template. Under the Builder tab select options.

Click on the standard values button. You should now see the following.

The reason you have to add standard values is for a couple reasons. This is where you can add default values to your data template, when a user creates a new instance of it it will be pre populated with the default values that you added. Standard values is also where you configure assignments rules and security. With the standard values node selected click on the configure tab, and then assign.

This assignment rule allows us to create SamplePages under sample pages, in essence you can create a hierachy of pages. Expand the content node and right click on the Home node, select Insert Sample Item and name it Page1.

This page won’t be able to display since we have not assigned  layout to it. If you navigate to it you will get a 500 error saying there isn’t a layout assigned to it.

The practical sitecore series is not an in depth view at sitecore. For detailed information please refer to the documentation on the sitecore sdn ( We intend to show you easy steps to get a site while keeping your code clear. If you do note have a license for sitecore you can download an express edition at

IIS 6 or greater.
SQL Server or SQL Server Express 2005/2008.
Visual Studio Express

Sitecore has a installer that will setup the database and website in iis, and add a local host header to you machine..

Sitecore can be very overwhelming when first learning the basics, and the way everything works together. The way i tend to think about data in sitecore is as a Document Database or a  collection of key value pairs. These documents are referred to Data Templates.


Getting Data

The primary way of querying in sitecore is using xpath queries. I recommend reading a small primer on xpath just to the basics (  As a result you will be two main methods  Sitecore.Data.Database.SelectItems, Sitecore.Data.Database.SelectItem, and one property Sitecore.Context.Item.

SelectSingleItem returns single object of type Sitecore.Data.Items.Item, Item acts as a dictionary of value. The values for the datatemplate can be found in the Fields property of the item. SelectItems returns an array of type Sitecore.Data.Items.Item.

Sitecore.Context.Item  is available to the current page that the user navigates to, this means all the data for the current page is readily available. No need to  search the database for that information.


Sitecore has a large number of field types we will cover a few small subset of them  Single-Line Text, Multi-Line Text, Rich Text, Checkbox and DateTime. These basics building blocks are what is sued  90% of the time.

Single-Line Text  is just as simple as its name, it represents a single line of text. This is often used for such things as titles.

Multi-Line Text this field types allows you to have content that spans multiple lines of text. one thing to note is that line breaks and carriage returns will not show up in the markup. You could do something like swapping the carriage return with break tags when rendering out.

Rich Text Field this your WYSIWYG editor that allows your users to format content. Similar to word, it also allows for large amounts of formatted text. Something to take into account is that when pasting from word the formatting will come over and override any formating you have in your style sheets.

Checkbox Field  allows you to  represent values true or false. This can be used to toggle features on and off on your website.

DateTime Field allows you represent a date along with the time of day, Users also get a nice date picker for setting the value.


I Have seen alot of sample where the API key is hard coded into, unless you are building a desktop there is no need to do this. Facebook provides the API key, and the session key in the iframe url. Your application should retrieve the keys from the url, this makre your code more portable.

Url Variables:

  • fb_sig_api_key
  • fb_sig_session_key
  • fb_sig_ss

UPDATE – 9/10/10

With the new changes to face book app, make sure that you go into the advanced setting and check canvas session parameters.

    In my experience i have found that using the JavaScript client library for Facebook and the External Interface API in flash is alot more responsive than the Adobe Facebook AS3 library. Sometimes the event fails to fire. The only time you should use the adobe library is when you need to upload fotos, and do so by sharing the session data used by the JavaScript client.

    Example of sharing a session:

    fb= new Facebook();
    var session:WebSession;
    session=new  WebSession(Application.application.parameters.fbsigapikey,
    session.addEventListener(FacebookEvent.CONNECT, function():void{
    var bytes:ByteArray = jpegencoder.encode(lastpumpyourselfbm.bitmapData);
    var call:UploadPhoto = new UploadPhoto(bytes);;