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!

Thursday, October 18, 2007

Things to remember before going to production


  1. Load testing with best in breed tools.
  2. Scan the Sitecore log files for latest 3 days and...
    • Any exceptions in the Sitecore Log files should be reported to tech support.
    • Any exceptions related to .NET Framework, ASP.NET worker process in the System Event Log should be investigated and reported to tech support.
  3. Special attention should be paid to the Item and Memory threshold warning in the log file.

The important thing to notice is the Page URL. If the front-end pages (not /sitecore/...  pages) are listed in these reports, there could be a potential problem in the code or ways to enhance to logic.

For example, the warning below shows that the timing exceeded the predefined limit:

5736 10:33:36 WARN  Timing threshold exceeded for web page. Milliseconds: 13072.38. Threshold: 7500. Page URL: /Default.aspx

while this message says that the logic of the page is trying to access more that the predefined limit of items:

6548 10:33:49 WARN  Item threshold exceeded for web page. Items accessed: 16715. Threshold: 7500. Page URL: /Default.aspx

So your actions:

  1. Identify the rendering logic producing such delay and heavy logic using Sitecore Debug mode.
  2. Refactor the code according to best practices (more about this below).
  3. Verify that this helped by scanning the log files and using Debug mode.

Best Practices and Techniques:

More about the predefined threshold parameters: