Friday, December 14, 2007

Power of Sitecore: Separation of UI and Data Layers


There is a simple approach on how you can accomplish user driven site design by letting them select different CSS files or skins.

What I did is put an XSLT rendering into the head section of the layout that will be reused across the pages:

<head>

<title>Some title</title>

<sc:XslFile ID="styleSelector" Path="/xsl/styleselector.xslt" runat="server" />

</head>

The source of the xslt rendering is looking for the “css” field of the “home” item which is a lookup pointing to the media library:

<!-- getting the id of the selected css asset -->

<xsl:variable name="cssAssetID" select="sc:fld('css',$home)"/>

<!-- getting the actual path of the css asset -->

<xsl:variable name="cssAssetPath" select="sc:fld('path',sc:item($cssAssetID,.))"/>

<!-- building the CSS link tag -->

<link href="{$cssAssetPath}" rel="stylesheet" type="text/css" />

The logic eventually outputs the link tag with the CSS file reference.

The “css” field is just a lookup field pointing to the media library repository with already uploaded CSS files and looks like:

css_field

The result of different selections is shown below.

For the “Basic Blue” selection:

blue_layout

For the “Basic Red” selection:

red_layout

WebEdit content markers


This is pretty simple, but still worth mentioning.

In order to add the green content markers to your page in XSLT, use this approach.

As for .NET, you have a number of options:

This will create the content marker that points to the context item: <sc:ContentDot id="contentDot" runat="server" />

This will create the content marker that points to the “news” item: <sc:ContentDot id="contentDot" DataSource="/sitecore/content/home/news" runat="server" />

This will create the content marker that points to the item with the specified ID: <sc:ContentDot id="contentDot" DataSource="{687BF9D7-9968-4EDF-863E-0A2611DDD51B}" runat="server" />

If you are constructing the controls dynamically, here is the solution.

Sunday, December 02, 2007

Instant Search in Windows 2008 Server


By default, the Instant Search service is not enabled on Windows 2008 server RC0. This makes my search in outlook rather insufficient. Fortunately, there is a solution. Thanks Olav.

Cannot upload big files on IIS7


I have stuck with this problem last week and killed some time trying to figure out what is going on. Finally, I asked the tech support to investigate further. Here is what they have found out: Thanks for the investigation, Andrey!