Wednesday, January 30, 2008

Dev Layout Chunk


When developing new web sites or demos with Sitecore, especially during the phase of building the presentation layer, I often have to switch to the Standard Fields and Raw Values to copy and paste layout definition from one item to another or from a template's standard values to another item. Also, sometimes I have to reset the layout field value to restore the inheritance from the standard values. This kind of operation takes at least 5 clicks, that's why I have created a "Dev Layout" chunk allowing you to do the following operations with one click:

  • Copy the presentation logic of the current item to the clipboard
  • Paste the presentation logic from the clipboard to the current item
  • Reset the layout field (set the value of the "Renderings" field to null which opens up field inheritance from standard values)
    • available for all the children of the selected item
  • Empty the layout field (set the value of the "Renderings" field to empty string which blocks the field inheritance from standard values BUT allows inheritance from the template itself)
    • available for all the children of the selected item

This is how it looks:

dev_layout

Here are the links:

Disclaimer:

This solution is provided AS IS, with no guarantee, and stuff. Sitecore is not responsible for supporting this extension which is considered as a product customization which means that this solution may not be working on next major releases while was developed on 5.3.1 build 071114.

Please do not deploy on the production servers as it was intended for developer use on designated dev boxes. Please use responsibly ;-)

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!