Introduction to Sitecore

The practical sitecore series is not an in depth view at sitecore. For detailed information please refer to the documentation on the sitecore sdn (http://sdn.sitecore.net/sdn5). 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 http://xpress.sitecore.net/.

Requirements:
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 (https://www.w3schools.com/xml/xpath_intro.asp).  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.

Fields

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.

 

Leave a Reply

Your email address will not be published. Required fields are marked *