Tuesday, January 19, 2010

Working with Session inside XSLT

Here we would be seeing two XSLT statements - firstly on how to set a value in session and secondly how to retrieve that session value:

<!-- Setting the Session Value -->
<xsl:value-of select="sc:SetSession('sessionval','2451')"/>

<!-- Retriving the Session Value -->
<xsl:value-of select="sc:Session('sessionval')"/>
The output can be observed on the front-end as: 2451

Monday, January 11, 2010

Sitecore Tweets n Tricks


Untitled DocumenHey Folks,

Got some really cool stuff and out of the box solution for things that could otherwise turn into some real headache...


1. Modifying page editor buttons

What would you do if you wanted to add a button to the page editor default toolbar? Well here's what I found.

Locate the page edit button:

Core: /sitecore/system/setttings/html editor profiles/rich text default_old/webeditButtons/

Duplicate an item there and you have a new button. In the datasection on the new item you find 3 options:

Icon - self explanatory

Tooltip - selfexplatory

Click: A call to a javascript function,

(Example)

Striketrough: javascript:Sitecore.WebEdit.execute("strikeThrough", true, true);

Italic: javascript:Sitecore.WebEdit.execute("Italic", true, true);

All the standard javascript execute commands should work

The result is a strikethough button:

Settings:

Click field: "javascript:Sitecore.WebEdit.execute("strikeThrough", true, true);"

Icon field: found an strike through icon in the standard sitecore image library.

Tooltip field: "Strike through"

The javascript-file with functions are found here : website/shell/applications/webEdit.js

Regarding calling sitecore functionality. There is only created 2 functions in the js file:

Insert image:

javascript:Sitecore.WebEdit.insertImage($JavascriptParameters)

Insert Link:

javascript:Sitecore.WebEdit.insertLink($JavascriptParameters)


So if you wan't to make something more that that we would have to write new functions for that.


2. using Sitecore.Kernel.Webutils

Webutils functions are great helper functions as well. If we want to get the url of the server, we can have it as a great help.

Install it in web.config:

<xslExtensions>

...

<extension mode="on" type="Sitecore.Web.WebUtil, Sitecore.Kernel" namespace="http://www.sitecore.net/webutil" singleInstance="true" />

</xslExtensions>


Now declare it in your xslt:

xmlns:webutil="http://www.sitecore.net/webutil"

Now it’s ready for use (example):

<xsl:text>Display Url: </xsl:text><xsl:value-of select="webutil:GetServerUrl()" /><xsl:value-of select="sc:path(.)" />



3. util:GetString

It might not strike us at the first thought but it’s really a common one - util:GetString(string, default).

A xsl:choose used to display the title of an item can be replaced as follows:

<xsl:choose>

<xsl:when test="sc:fld('menutitle',.)">

<xsl:value-of select="sc:fld('menutitle',.)">

</xsl:when>

<xsl:when test="sc:fld('title',.)">

<xsl:value-of select="sc:fld('title',.)">

</xsl:when>

<xsl:otherwise>

<xsl:value-of select="./@name">

</xsl:otherwise>

</xsl:choose>


simpler call:

<xsl:value-of select="util:GetString(util:GetString(sc:fld('title',.), sc:fld('menutitle',.)),@name)"/>



Hope they work for you.... :-)





Thursday, August 20, 2009

Sitecore Makes it Effortless to Create Content and Experience Rich Websites

Sitecore helps you achieve your business goals such as increasing sales and search engine visibility, while being straightforward to integrate and administer. Sitecore lets you deliver sites that are highly scalable, robust and secure, and is built to simplify your life, automate your processes, and let you deliver results faster.

Fast Intuitive Editing

If you know how to use Microsoft Word, you will feel right at home with Sitecore CMS. Sitecore CMS presents users with an Office 2007 style "ribbon" interface, so you'll be immediately familiar with its editing environment. You'll be editing your site and up to speed in no time.


Integration Anywhere and Everywhere

Today’s modern websites are more connected to our businesses than ever. Sitecore was built from the ground up to enable you to weave your strategic applications into your websites and deliver compelling user experiences. Built on the .NET framework and based open standards and international accessibility standards, Sitecore lets you integrate any and all of your line of business applications, from ERP suites to CRM systems.


Multi-Site Deployment Made Easy

Award-winning architecture enables you to manage and deploy an unlimited number of sites and share content, code and processes across any of your sites.


Built to Scale

Sitecore is designed to drive the largest sites on the planet. Having a site powered by Sitecore gives you the confidence that you can deliver compelling user experiences at lightning speeds using a combination of high availability options, intelligent caching controls, and the power of ASP .NET 2.0.


Google-Friendly URLs Improve Site Rankings Instantly

Search engine optimization is an important part of every company’s marketing strategy. Sitecore natively delivers URLs that improve organic search results. Once visitors arrive at your site, Sitecore offers a powerful site search function that leads visitors directly to the information they want.


Rapid Development

Sitecore lets you use the tools you want to use and provides unparalleled support for .NET developers. Sitecore lets you work directly in Sitecore or lets you use external tools such as Microsoft Visual Studio. By providing capabilities such as code-completion enhancements and integrated debugging tools, we make developer’s lives easier by reducing errors and increasing programming speed.


Ideal For International Companies

The world is getting smaller every day, and more and more companies are going global. Sitecore allows editors to work with the CMS in their native languages by supporting all major languages, and allows you to build websites in any language. Sitecore also lets you to coordinate the management of the many language versions of your website, as well as the translation processes as content changes across those language sites.