Tuesday 10 September 2013

Getting Sitecore items

All items ca be accessed from Sitecore.Data.Items.Item class.

//Get the master database through a Factory
Database masterDb = Sitecore.Configuration.Factory.GetDatabase("master");



//Retrieving an item with a path through the database
Sitecore.Data.Items.Item myItem = masterDb.Items["/sitecore/content/home"];


//Retrieving an item from an item id
Sitecore.Data.Items.Item mySecondItem = masterDb.Items[new ID("{CC07A18cA-670D-5458-9A1S-G3072D1A0BE5}")];

Thursday 5 September 2013

Advantages of using sublayouts:

Advantages of using sublayouts:

  • Sublayouts support a superset of the features that XSL renderings, web controls, and user controls support.
  • Sublayouts provide markup templates with code-behind to separate logic from presentation.
  • Sublayouts can access all Sitecore APIs and any other APIs available to the ASP.NET worker process.
  • Sublayouts support placeholders, allowing dynamic nesting of presentation components to any level.
  • Sublayouts support debugging with the Visual Studio debugger.
  • Sublayouts support compile-time error detection.
  • If it helps in the migration of existing code or the integration of third-party components, you can easily implement a sublayout as a wrapper for a single web control.