Wednesday, August 7, 2013

CQWP for image or content sliders

Sharepoint 2010 's Content Query webpart is my favorite webpart of all the webparts in the world.

Out of the box it can do a lot of things and you can easily customize display styles. Unfortunately applying css or using jquery in CQWP becomes quite painful. 

For a recent project we had a requirement to pull News Pages from all subsites and display them using CQWP in a content slider. 

I modified ContentQueryMain.xsl, Header.xsl and Item.xsl to get the results I need

Link to modified ContentQueryMain-modified.xsl file

  1. ContentQueryMain.xsl - Removed Columns, Removed assignment of <li> to an item and added it to the ItemStyle.xsl file, added styles to Group header depending on a group name.

    lines modified in the original ContentQueryMain.xsl file:
    Line 32: replaced dfwp-list with header-column for the class
    Line 34: removed BeginListItem replaced with StartGroupStyle- prints out <li class="
    Line 35: removed EndListItem replaced with EndGroupStyle - prints out </li>
    Line 36: added endlistitemclass - prints out "> to close <li class="

    Line 83: replaced class dfwp-column dfwp-list with listings clearfix
    Line 84: removed %&quot; - this was printing  % at the end of the calculated column width (1, 2. 3 columns in the CQWP settings)
    Line 85: removed $cbq_columnwidth, this was calucated width of the column, useless

    modifications to CallHeaderTemplate - Line 140

    <xsl:template name="OuterTemplate.CallHeaderTemplate">
            <xsl:value-of select="$StartGroupStyle" disable-output-escaping="yes"/>
            <xsl:value-of select="translate(@*[name()=$Group],translate(@*[name()=$Group], &#39;abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789&#39;,&#39;&#39;),&#39;&#39;)"/>
            <xsl:value-of select="$endlistitemclass" disable-output-escaping="yes"/> 
    
            <xsl:apply-templates select="." mode="header">
            </xsl:apply-templates>
          <xsl:value-of disable-output-escaping="yes" select="$BeginList" />
        </xsl:template>

    after calling the template name I added variable declared on line 34 which will give us start of list item - $StartGroupStyle
    next value is the Name of the group spaces removed
    finishing up with $enndlistitemclass
    so the above will generate header as a list item with nested unordered list

    Line 148: removed $BeginListItem since the list item will be assigned to the item template
    Line 170: removed $EndListItem

    Modifications to CallFooterTemplate - Line 172
    <xsl:template name="OuterTemplate.CallFooterTemplate">
          <xsl:value-of disable-output-escaping="yes" select="$EndList" />
         <xsl:value-of select="$EndGroupStyle" disable-output-escaping="yes"/>
        </xsl:template>
    Replaced $EndListItem with $EndGroupStyle

  2. Header.xsl
    Default header style is generating <li> Header</li> this is no longer needed

    Updated Default Header Template
    <xsl:template name="DefaultHeader" match="*" mode="header">
          <xsl:call-template name="OuterTemplate.GetGroupName">
            <xsl:with-param name="GroupName" select="@*[name()=$Group]"/>
            <xsl:with-param name="GroupType" select="$GroupType"/>
          </xsl:call-template>
      </xsl:template>
    

  3. ItemStyle.xsl
    Make sure you go through all Item template and add <li class="YOURCLASS"> after last variable declaration and </li> right before </xsl:call-template>
    This is will not take much time but at the end you will be able to assign your own classes to each item style.

    Item template for the page display will have the following structure

    I will use default fields available in the page content type:
    Rollup Image
    Title
    Page Content
    you can use Comments field instead of Page Content, it depends on your presentation
    <xsl:template name="News-Articles" match="Row[@Style='News-Articles']"
            mode="itemstyle">
            <xsl:variable name="SafeLinkUrl">
                <xsl:call-template name="OuterTemplate.GetSafeLink">
                    <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
                </xsl:call-template>
            </xsl:variable>
            <xsl:variable name="bodyContent">
                <xsl:call-template name="removeMarkup">
                    <xsl:with-param name="string" select="@PublishingPageContent"/>
                </xsl:call-template>
            </xsl:variable>
    
            <li class="News-Articles">
                <xsl:value-of select="@PublishingRollupImage" disable-output-escaping="yes"/>
                    <a href="{$SafeLinkUrl}">
                        <xsl:value-of select="@Title"/>
                    </a>
                    <xsl:value-of select="substring($bodyContent,1,100)"/> 
                <a href="{$SafeLinkUrl}" mce_href="{$SafeLinkUrl}" title="{@Title}">READ MORE</a>  
            </li>
        </xsl:template>
        <xsl:template name="removeMarkup">
            <xsl:param name="string"/>
            <xsl:choose>
                <xsl:when test="contains($string, '&lt;')">
                    <xsl:variable name="nextString">
                        <xsl:call-template name="removeMarkup">
                            <xsl:with-param name="string" select="substring-after($string, '&gt;')"/>
                        </xsl:call-template>
                    </xsl:variable>
                    <xsl:value-of select="concat(substring-before($string, '&lt;'), $nextString)"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="$string"/>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:template>

    Add your own styles and that's pretty much it.


As for the content slider you can use any plugin available that auto generates item indicators and prev. next arrows such as http://v3.bxslider.com/

Add CQWP to the page point to the site you need to get content from, set your filters add grouping - grouping generates css class for the list items, below is the generated code from a test CQWP

<ul class="listings">
  <li class="ABOUTUS">ABOUT US
    <ul class="header-column">
      <li class="Vol-Opps"> <a href="#">About Us</a><br>
        
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras sodales urna turpis. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam egestas risus sed justo blandit tincidunt. Cras cursus enim a massa commodo commodo. 
        ( <a title="About Us" href="#">...</a> ) </li>
      <li class="Vol-Opps"> <a href="#">Publications</a><br>
    
       Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras sodales urna turpis. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam egestas risus sed justo blandit tincidunt. Cras cursus enim a massa commodo commodo. 
        ( <a title="Publications" href="#">...</a> ) </li>
      <li class="Vol-Opps"> <a href="#">Newsroom</a><br>
        
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras sodales urna turpis. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam egestas risus sed justo blandit tincidunt. Cras cursus enim a massa commodo commodo. 
        ( <a title="Newsroom" href="#">...</a> ) </li>
    </ul>
  </li>
</ul>

you can hide the group title by using empty Group Header style.

to activate content slider on the above list: (make sure you have .js, .css on your page )

<script type="text/javascript">
  $(document).ready(function(){
    $('.ABOUTUS>ul').bxSlider();
  });
</script>



Thursday, March 8, 2012

DVWP - Video Gallery with Overlay Silverlight Media Player - Sharepoint 2010

There are multiple blogs already available on how to use built-in Silverlight Media Player in Sharepoint (I am using info provided on these two):

http://jomit.blogspot.com/2009/12/using-silverlight-media-player-of.html

http://blogbaris.blogspot.com/2010/11/play-video-from-asset-library-in.html
and many more just search for  _spBodyOnLoadFunctionNames.push('mediaPlayer you will get the list.

the directions are very simple: Add code and divs with static links to Content Editor Webpart and voilĂ  you've got yourself a video list.

But if you have a library where videos are uploaded daily, then you have to update it every time a new video needs to be posted, and I don't like sticking code in Content Editor WP.

Data View Web Part (DVWP) does it better and you set it up once.

Microsoft's Sharepoint videos page is using DVWP with media player above the listing - v. fancy
http://sharepoint.microsoft.com/en-us/Pages/Videos.aspx?VideoID=30


I like the overlay option because in case the video library is long, clicking on the link takes you to the top of the page where media is playing and then you have to scroll down to view another video.

Description: Data View Web Part modified to play videos in overlay, preview images and titles are linked,  links are sorted by Modified Date, Comments Field is a description. All of these fields are default fields attached to Asset library.
In Publishing site with custom page layouts you will have to detach page from the layout and reattach it to make changes. Page with the video list should be in the same site as the Assets/Video library.

1. Create new Asset library, name it.
2. Upload your videos wmv, avi or mp4, add Title, Comments and link to the preview image


3. Open Site in Sharepoint Designer, Expand "All Files", expand "Pages" folder, I am modifying videoLibrary.aspx file. Right click on the file and select "Detach From Page Layout", right click again and this time "Edit File in Advanced Mode"

4. Click on "Split" to show Split view of the Design and Code (bottom of the editing area)
in the design view locate Web Part Zone and click inside the area.

5. From the Ribbon > Insert Tab> In the Data Views & Forms Area > Select Data View > Empty Data View

6. Select your video library from Document Libraries by clicking on "Select a data source"

7. In the Data Source Details area select first item in the Rows this will create connection to the list, usually it is Name field and from the dropdown "Insert Selected Fields as" select "Multiple Items View".

8. From the Ribbon > Data View Tools > Paging > All Items

9 From the Ribbon > Data View Tools > Sort & Group: add Modified and Select Ascending

10. In the Web Part Tab Set Chrome Type to None

11. In the Web Part Tab click on Properties and in the Data View Properties click on the XSL editor

Replace SP xsl with the following



<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema"
    xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0"
    exclude-result-prefixes="xsl msxsl ddwrt ddwrt2 __designer asp SharePoint d x"
    xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
    xmlns:asp="http://schemas.microsoft.com/ASPNET/20"
    xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
    xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal">
    <xsl:output method="html" indent="no"/>

<!-- Start Template -->
    <xsl:template match="/">
        <!-- Container  ID should match getElementByID -->
        <div id="mediaPlayerList">
            <xsl:apply-templates/>
        </div>
        <!-- Link into Video Overlay  -->
        <script type="text/javascript" src="/_layouts/mediaplayer.js"/>
        <script type="text/javascript">
             <![CDATA[
            _spBodyOnLoadFunctionNames.push('mediaPlayer.createOverlayPlayer');
            mediaPlayer.attachToMediaLinks
            (
            (document.getElementById('mediaPlayerList')),[ 'wmv', 'avi', 'mp4']);//]]>
        </script>
    <!-- Firefox fix for the media player -->
        <object height="1" width="1" id="Silverlight_Shared_MediaPlayer"
            data="data:application/x-silverlight," type="application/x-silverlight"
            style="position: fixed; top: 0pt; left: 0pt; z-index: 50;">
            <param value="#80808080" name="background"/>
            <param value="true" name="enableHtmlAccess"/>
            <param value="/_layouts/clientbin/mediaplayer.xap" name="source"/>
            <param value="isOverlayPlayer=true" name="initParams"/>
            <param value="true" name="windowless"/>
        </object>

    </xsl:template>
<!-- End Template -->
    <xsl:template match="/dsQueryResponse/Rows/Row">

        <!-- This markup is used for each item in the list -->
  <div class="mediaItem">
   <div class="mediaTitle"><a href="{@FileRef}"><xsl:value-of select="@Title"/></a></div>
   <div class="mediaImage"><a href="{@FileRef}"><img border="0" src="{@AlternateThumbnailUrl}" alt="{@AlternateThumbnailUrl.desc}"/></a></div>
   <div class="mediaDescription"><xsl:value-of select="@_Comments"/></div>
  </div>
    </xsl:template>
</xsl:stylesheet>


Save the page, reattach it to the page layout.

I am not including any css to go with my classes for title, image and description, these are the id and classes used:
#mediaPlayerList - container for the entire list
.mediaItem - container for each item float it to the left add some width and you can set it as multi col. display
.mediaTitle - div for the title
.mediaImage - div for the image set width/height to a number to re-size all the thumbnails
.mediaDescription - div for the video description - Comments field


There are probably blogs that have these instructions and better, but I could not find anything useful to me - I only have access to SP Designer. So if you have a secret stash of blogs that do, don't be a stranger share, because sharing is caring :)

Saturday, November 12, 2011

SEO for SharePoint 2010

You've done your SEO research, found all the keywords for the Titles and came up with perfect descriptions..... now where does it all go in your SharePoint site?

By default there is no meta description tag in master pages, search engines will pick up text from your page, and the title that you see in the browser tab is the title of your page or site.

The solution is pretty straight forward: Create custom columns for SEO Title and Description tags and add them to their own content type based on the Article page layout (I am working with publishing site). Of course you can add your custom columns to Article page, but on the other hand, not all of the pages will need to have SEO Titles and Descriptions. 

All of the work will be done in SharePoint Designer, so check your permissions on the site you will need to have access to Site Columns, Content Types and Page Layouts.
Creating New Site Columns for SEO Title and Description (meta description tag)

SEO Title:

Open the site in SP Designer, in Site Object select Site Columns and create New Column> Single Line of Text give it a Name (SEO Title) add description if you want, and select Existing group: Custom columns, OK.

SEO Description:
In Site Columns again create New Column > this time select Multiple Lines of Text* give it a Name (SEO Description) add description if you want, select Existing group: Custom columns, OK.

*Google search will display 160 characters for the description, default length of the Muli line text field is 255 characters.  
Save Site Columns (Top left corner Save Icon)

SEO Title and SEO Description are now under Custom Columns:

Creating Custom Content Type:

In Site Objects select Content Types, from the ribbon Content Type (New):
Name - SEO Page Layout
Select parent content type from:  Page Layout Content Types
Select parent content type: Article Page
Existing group: Page Layout Content Types
OK


In Content Types (1) scroll down to Page layout content types, click on the newly created SEO Page Layout content type(2) and click on Edit Columns (3)

From the ribbon click on Add Existing columns, Scroll Down to Custom Columns add SEO Title column, click OK. repeat for SEO Description Column.


Save Content Type by clicking on Save Icon (top left corner)

Adding SEO Title and SEO (meta) Description Fields to the page layout

In Site Objects click on Page Layouts, from the ribbon Click on New Page Layout
in Content Type Name dropdown select SEO Page Layout, give it a Name and Title

The default new page layout will be created with two content placeholders: PlaceHolderPageTitle and PlaceHolderMain

We need to add an extra content placeholder to hold our Meta Description tag - SEO Description - PlaceHolderAdditionalPageHead, asp literal tags will hold the tag itself with metaStart to start the meta tag containing meta name and content and metaEnd closing tag - place the code above PlaceHolderPageTitle:
(PlaceHolderAdditionalPageHead is a required placeholder for the masterpages it is sitting inside the <head></head> tag in v4.master and nightandday.master)

<asp:Content ContentPlaceholderID="PlaceHolderAdditionalPageHead" runat="server">
<asp:literal ID="metaStart" runat="server" Text="&lt;meta name=&quot;description&quot; content=&quot;"/>
<SharePointWebControls:FieldValue id="MetaDescription" FieldName="SEO Description" runat="server"/>
<asp:literal id="metaEnd" runat="server" Text="&quot;&gt;"/>
</asp:Content>

Modify existing PlaceHolderPageTitle by adding SEO Title field value right after the PageTitle:

<asp:Content ContentPlaceholderID="PlaceHolderPageTitle" runat="server">
 <SharePointWebControls:FieldValue id="PageTitle" FieldName="Title" runat="server"/>
 <SharePointWebControls:FieldValue ID="SEOTitle" runat="server" FieldName="SEO Title"/>
 
</asp:Content>



Save the page layout check in, publish and approve. Make sure this page layout is available on the site by checking Site Actions>Site Settings> Page Layouts and Site Templates.

Now the easy part: Navigate to the page that needs to have SEO Title and Description added.
Check out the page, Edit page, from the Ribbon click on Page Layout and select SEO Default Page Layout under our custom SEO Page Layout type

From the ribbon click on  Edit Page Properties, scroll down to SEO Title and Description and add your text
Save, check in the page, publish and approve, the browser tab is now displaying SEO Title text next to the page title.

View source of the page and search for your Description text


done.

Saturday, October 29, 2011

DVWP (Data View Web Part) as a rotating banner : SharePoint 2010 & Jquery

Description: Data View Webpart modified to display images from the local image library, images are linked, url opens in the new window or parent window, Start Date and End Date are used to expire/activate banners, images are sorted by number specified in a custom column (Position).
Specs
: Public facing Publishing site on SharePoint 2010 Foundation, custom master page - I am using Heather Solomon's Publishing master, (simple) custom page layout with a webpart zone - check Randy Drisgill's branding post, custom css.



First thing to mention this set up will only work on the site where the image library list is located, very useful for home page banner.
There is no clip region in the banner rotator so make sure that your banner images are all the same size. 
Custom Image library does not have an approval workflow activated, you can add Versioning Settings in the library settings and then add additional filter in the Data View Webpart to display only Approved Items.


You will need SharePoint Designer and Nivo slider with default template (this is the first one that popped up in my search) download Free jquery plugin. 


  1. Create HomePageBannerImages image library with three custom columns:
    From Site Actions > More Options > Picture Library  > Create - Name it (HomePageBannerImages)
    From Settings in the image library select Create Column to create the following columns:
    LinkURL - Hyperlink or Picture, Require that this column contains information, Format Url as Hyperlink, Add to default view
    Position - Number, Require that this column contains information, Add to default view
    TargetWindow - Choice, Require that this column contains information, Type each choice ... :_parent _blankAdd to default view - you can always set choices as New Window, Same Window- easier for the end users- and then use conditional statements in xsl to render correct target for the url.
  2. Unzip Nivo Slider package and upload files to the folders, I've created CustomCss and js folders in Style Library/en-us/:
    js: jquery.nivo.slider.pack.js
    CustomCss: default.css (themes/default folder in nivo package) and nivo-slider.css
    Images folder: bullets.png, arrows.png and loading.gif (themes/default folder in nivo package)
    modify default.css file to point images to correct folder i.e: background:#fff url(/images/loading.gif) no-repeat 50% 50%;
  3. In Sharepoint Designer create new page layout copy/paste code below. What I have is very Simple Page Layout for the home Page:  Banner area (webpart zone), Content Editor and table with 3 webpart zones for various feeds.
    *Make sure you add link to jquery library in your master page
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
     I am adding links to js slider and css files in the page layout simply because this will be the only page that will hold the banner
    <%@ Page language="C#"   Inherits="Microsoft.SharePoint.Publishing.PublishingLayoutPage,Microsoft.SharePoint.Publishing,Version=14.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" meta:progid="SharePoint.WebPartPage.Document" meta:webpartpageexpansion="full" %>
    <%@ Register Tagprefix="SharePointWebControls" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="PublishingNavigation" Namespace="Microsoft.SharePoint.Publishing.Navigation" Assembly="Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <asp:Content ContentPlaceholderID="PlaceHolderAdditionalPageHead" runat="server">
    <script type="text/javascript" src="/Style Library/en-us/js/jquery.nivo.slider.pack.js"></script>
    <link rel="stylesheet" href="/Style Library/en-us/CustomCss/default.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="/Style Library/en-us/CustomCss/nivo-slider.css" type="text/css" media="screen" />
    <style type="text/css">
    #slider a{
    display:block;
    }
    </style>
    <script type="text/javascript">
     $(window).load(function() {
            $('#slider').nivoSlider({
            effect: 'slideInLeft',
            animSpeed: 500,
            pauseTime: 5000,
            pauseOnHover: true
            });
        });
        </script>
    
    </asp:Content>
    
    <asp:Content ContentPlaceholderID="PlaceHolderPageTitle" runat="server">
     <SharePointWebControls:FieldValue id="PageTitle" FieldName="Title" runat="server"/>
    </asp:Content>
    
    <asp:Content ContentPlaceholderID="PlaceHolderMain" runat="server">
    <WebPartPages:SPProxyWebPartManager runat="server" id="spproxywebpartmanager"></WebPartPages:SPProxyWebPartManager>
    <div id="banner">
    <WebPartPages:WebPartZone id="g_C7F9DDBE501142A69EE4B39CF62A1A12" runat="server" title="Banner"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>
    </div>
    <div id="Article">
    <PublishingWebControls:RichHtmlField FieldName="f55c4d88-1f2e-4ad9-aaa8-819af4ee7ee8" runat="server" AllowFontColorsMenu="False" AllowFontStandardColors="False" AllowFontThemeColors="False" AllowStandardFonts="False" AllowThemeFonts="False" MinimumEditHeight="400px"></PublishingWebControls:RichHtmlField>
    <table width="100%"> <tr><td valign="top" style="width:270px;">
    <WebPartPages:WebPartZone Title="left" runat="server" ID="left" CssClass="Blog"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone></td>
    <td valign="top" style="width:270px;">
    <WebPartPages:WebPartZone Title="center" runat="server" ID="center" CssClass="Events"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone></td>
    <td valign="top" style="width:270px;">
    <WebPartPages:WebPartZone Title="right" runat="server" ID="right" CssClass="Press"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone>
    </td></tr></table>
    </div>
    </asp:Content>
    

    Save page Layout, check in, publish and approve. Check the site settings and make sure the page layout is available in Page Layouts. Go to the page where you need your banner: Edit page and Apply newly created layout. Save the page.
  4. Open Site in Sharepoint Designer, Expand "All Files", expand "Pages" folder, I am modifying default.aspx file. Right click on the file and select "Detach From Page Layout", right click again and this time "Edit File in Advanced Mode"
  5. Click on "Split" to show Split view of the Design and Code (bottom of the editing area)
    in the design view locate Banner div and click inside the Banner div area.
  6. From the Ribbon > Insert Tab> In the Data Views & Forms Area > Select Data View > Empty Data View
  7. Select HomePageBannerImages from Document Libraries by clicking on "Select a data source"
  8. In the Data Source Details area select first item in the Rows, usually it is Name field and from the dropdown "Insert Selected Fields as" select "Multiple Items View".

    Now the fun stuff:
  9. From the Ribbon > Paging > All Items
  10. From the Ribbon > Sort & Group: add Position and Select Ascending
  11. From the Ribbon > Filter set filters as shown below (Less Than or Equal  AND  Greater Than or Equal to)
  12. In the WebPart Zone Tools Set Chrome Type to None
  13. In the WebPart Zone click on Properties and in the Data View Properties click on the XSL editor
  14. Replace all the fancy SP stuff with the following xsl:
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
        xmlns:ddwrt2="urn:frontpage:internal"
        xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
        exclude-result-prefixes="ddwrt2 ddwrt">
        <xsl:output method="html" indent="no"/>
        <xsl:param name="Today">CurrentDate</xsl:param>
        <xsl:template match="/">
            <div class="slider-wrapper theme-default">
                <div class="ribbon"></div>
                <div id="slider" class="nivoSlider">
                    <xsl:apply-templates select="*"/>
                </div>
                <div id="slideshow_btns"></div>
            </div>
        </xsl:template>
        <xsl:template match="Row">
            <a href="{@LinkURL}" target="{@TargetWindow}"><img border="0" src="{@FileRef}" alt="{@FileRef}"/></a>
        </xsl:template>
    </xsl:stylesheet>
    

Save the page, right click on the page name in Pages and reattach it to the page layout. check in and that's pretty much it.
now Add images to your image library and watch them rotate ... mesmerizing....
you can add more options to nivo slider add fancy transitions and tooltips (check documentation on their site) obviously you can do a lot more with Data View display but this is just simple and quick way to make a banner rotator.

Let me know if there are any issues with this or something is not clear/missing.

Replace default navigation indicators with image thumbnails



You will need to make 3 adjustments to your slider: add css classes for the images and css class to the slider, modify options for your script and edit xsl template to include rel attribute containing path to the thumbnail

  1. Add the following css to your default.css style sheet

    .theme-default.controlnav-thumbs .nivoSlider {
        margin-bottom:100px; /* Tweak this to push content down */
    }
    .theme-default.controlnav-thumbs .nivo-controlNav {
        position:absolute;
        left:0px;
        bottom:-80px; /* Tweak this to push thumbnails down */
        margin:0;
    }
    .theme-default.controlnav-thumbs .nivo-controlNav a {
        display:inline;
        background:none;
        text-indent:0px;
        border:0;
        margin-right:10px;
        float:none;
    }
    .theme-default.controlnav-thumbs .nivo-controlNav a.active img {
        -webkit-box-shadow: 0px 1px 5px 0px #4a4a4a;
        -moz-box-shadow: 0px 1px 5px 0px #4a4a4a;
        box-shadow: 0px 1px 5px 0px #4a4a4a;
    }
    .theme-default.controlnav-thumbs .nivo-controlNav img {
        display:inline;
        position:relative;
        margin-right:10px;
    }
  2. add Use thumbnails Control Nav and Use image rel for thumbs options to your script (last two options)

    <script type="text/javascript">
        $(window).load(function() {
            $('#slider').nivoSlider({
            effect: 'slideInLeft',
            animSpeed: 500,
            pauseTime: 5000,
            pauseOnHover: true,
            controlNavThumbs:true,
         controlNavThumbsFromRel:true
            });
        });
        </script>
    
  3. Add rel attribute to the banner image

    There are two options to pull in thumbnails for the slider:
    • Set up separate Picture library in the same subsite just for thumbnails, upload thumbs into this library, add extra column (Picture) to your Banner Picture library, add thumbs to your newly created column and add the field to the rel="{@ThumbnailImageRef}" in your xsl template.
    • Use Thumbnails auto-created by Sharepoint 

      I like the second option because SharePoint created everything I need:
      if your banner image in HomePageBannerImages library is ForeverGreen.jpg with /HomePageBannerImages/ForeverGreen.jpg path,  the path to thumbnail for this image will be /HomePageBannerImages/_t/ForeverGreen_jpg.jpg and it is pretty easy to construct xsl string to render the path, XPath Expression Builder helps a lot  - final result:

      rel="{concat(@FileDirRef,'/_t/', substring-before(@FileLeafRef,'.'),'_',substring-after(@FileLeafRef,'.'),'.',@FileType)}"
      now add the above to your image tag after alt="{@FileRef}"
      remove<div id="slideshow_btns"></div> this is no longer needed add controlnav-thumbs class to the slider-wrapper div
      your final xsl


      <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
          xmlns:ddwrt2="urn:frontpage:internal"
          xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
          exclude-result-prefixes="ddwrt2 ddwrt">
          <xsl:output method="html" indent="no"/>
       <xsl:param name="Today">CurrentDate</xsl:param>
          <xsl:template match="/">
              <div class="slider-wrapper theme-default controlnav-thumbs">
         <div class="ribbon"></div>
                  <div id="slider" class="nivoSlider">
          <xsl:apply-templates select="*"/>
         </div>
         
        </div>
              
          </xsl:template>
          
          <xsl:template match="Row">
              
                  <a href="{@LinkURL}" target="{@TargetWindow}"><img border="0" src="{@FileRef}" alt="{@FileRef}" rel="{concat(@FileDirRef,'/_t/', substring-before(@FileLeafRef,'.'),'_',substring-after(@FileLeafRef,'.'),'.',@FileType)}"/></a>
      
          </xsl:template>
      </xsl:stylesheet>