<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dave Cavins &#187; SharePoint Designer</title>
	<atom:link href="http://davecavins.com/tag/sharepoint-designer/feed/" rel="self" type="application/rss+xml" />
	<link>http://davecavins.com</link>
	<description>web design, SharePoint customization &#38; random stuff</description>
	<lastBuildDate>Tue, 27 Dec 2011 14:22:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>#SharePoint Designer Custom Activities Risky?</title>
		<link>http://davecavins.com/2011/03/spd-custom-activities-risks/</link>
		<comments>http://davecavins.com/2011/03/spd-custom-activities-risks/#comments</comments>
		<pubDate>Fri, 04 Mar 2011 20:21:48 +0000</pubDate>
		<dc:creator>davecavins</dc:creator>
				<category><![CDATA[General SharePoint]]></category>
		<category><![CDATA[SharePoint Designer]]></category>
		<category><![CDATA[SPD Custom Activities]]></category>

		<guid isPermaLink="false">http://davecavins.com/?p=594</guid>
		<description><![CDATA[SPD Custom Activities are an add-on many people use because they add new custom activities and conditions that can be used in SharePoint Design workflows. SPD Custom Activities give designers the ability to create more complex and powerful workflows without having to know code or use Visual Studio for development.  Check out a list of the activities [...]


Related posts:<ol><li><a href='http://davecavins.com/2009/12/displaying-document-titles-as-links/' rel='bookmark' title='Displaying document titles as links.'>Displaying document titles as links.</a></li>
<li><a href='http://davecavins.com/2011/11/some-thought-on-sharepoint-adoption/' rel='bookmark' title='Some thoughts on #SharePoint Adoption'>Some thoughts on #SharePoint Adoption</a></li>
<li><a href='http://davecavins.com/2009/12/updating-the-people-picker/' rel='bookmark' title='Updating the People Picker'>Updating the People Picker</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>SPD Custom Activities are an add-on many people use because they add new custom activities and conditions that can be used in SharePoint Design workflows. SPD Custom Activities give designers the ability to create more complex and powerful workflows without having to know code or use Visual Studio for development.  Check out a list of the activities and descriptions <a href="http://spdactivities.codeplex.com/wikipage?title=Available%20Activities&amp;referringTitle=Home" target="_blank">here</a>.</p>
<p>These activities have many benefits for users including:</p>
<ul>
<li>Make the automation of business processes easier</li>
<li>Easier to build complex applications without the help of a (costly) developer.</li>
<li>More power in the hands of the user</li>
<li>Can quickly prototype, test and deliver applications</li>
<li>Easier to manage and make changes to applications in production</li>
</ul>
<p>On the other hand I feel it is important to consider the SPD Custom Activities from a governance and management standpoint.  If you are responsible for managing and supporting the SharePoint environment its important to consider not only how these types of solutions will help the user but how will they affect the stability of your environment?</p>
<p>I will discuss a few of the main risks I discovered while researching SPD Custom Activities along with <a title="Gabe on Twitter" href="http://twitter.com/gabehilado" target="_blank">Gabe Hilado</a> of <a title="Zenpo Software" href="http://www.zenposoftware.com/" target="_blank">Zenpo Software</a>.</p>
<p><span id="more-594"></span></p>
<h2>Access</h2>
<p>In order to use the custom activities you need SharePoint Designer installed on your workstation and you need at least site owner permissions.  Because SharePoint designer is now free any user can get it installed and with the right permissions begin building workflows.  With the custom activities it is easier to build more complex workflows.  Simple mistakes in the workflow could potentially lead to performance issues (I&#8217;ll explain later).  It may be best to establish some sort of training for users before they are given access to SharePoint Designer to ensure they have some understanding of workflow best practices. This point applies if you have SPD Custom Activities installed or not even the OOTB workflows can create issues.</p>
<h2>Proper Development Practices</h2>
<p>Developing workflows in SharePoint Designer is relatively easy and does not require the creator to follow any specific process.  Users can easily setup a mission critical application in SharePoint within a few days or weeks.  This can make it difficult to support your SharePoint users, here is why.  When users can develop complex applications without following SDLC best practices (dev &#8211; test &#8211; production) it&#8217;s easy to have problems in your SharePoint environment without even knowing about them. Additionally as the system owner you may not even know about these applications and their support requirements.  When something breaks or the developer leaves how can you support/repair something that was not properly documented or tested. As mentioned earlier these issues are not all specific to SPD custom activities but because of its power can have a larger impact.</p>
<h2>Potentially Broad Impact</h2>
<p>Workflows are used to automate processes involving large number of items, for processes. If the process only involved a few items users would do it manually through the interface. Poorly-designed automated workflows have the potential to affect large number of items very quickly.  SPD Custom Activities adds the ability for these workflows to not only edit permission but also trigger other workflows.  When one workflow can start another workflow it&#8217;s easy to create a loop that could affect many items very quickly and be hard to troubleshoot as an outsider.</p>
<h2>Performance</h2>
<p>SharePoint can experience performance degradation with a large number of unique security scopes in lists<br />
Link: <a href="http://support.microsoft.com/kb/2420771">http://support.microsoft.com/kb/2420771</a></p>
<p>According to article</p>
<p><em>&#8220;When more than 1,000 security scopes are created for folders or documents in a list, there’s a significant performance degradation in SharePoint operations that badly affects end users operations(rendering content) as well as SharePoint activities like indexing SharePoint Content.  After the number of unique security scopes exceeds1,000 per list, SharePoint uses a code path that requires additional SQL round trips to analyze the scopes before rendering a view. When there are 1000 or fewer scopes, only one round trip is required.&#8221; </em></p>
<p>This mainly related to the permissions related activities in SPD Custom Activities.  Its true that a user could run into the same problem by manually breaking permissions on many items through the interface however this is unlikely to happen. If a workflow is built improperly and leaves permissions disinherited the process becomes automated.  Automating a bad practice is probably not a good idea.</p>
<h2>Conclusion</h2>
<p>By no means is this post meant to say that SPD custom activities are bad or should not be used.  I think they are very useful and can be very helpful when used properly. It&#8217;s important to plan ahead and ensure the proper governance is in place to prevent issues like those mentioned above.   If you don&#8217;t the time or resources to put some sort of governance in place to protect your farm it may be best to do custom workflow development in Visual Studio where it can be properly tested and packaged.</p>
<h2>Useful Resources</h2>
<ul>
<li><a href="http://blog.qumsieh.ca/2010/01/16/failed-to-load-workflow-error-in-sharepoint-designer/" target="_blank">Custom Activities in 2010</a></li>
</ul>


<p>Related posts:<ol><li><a href='http://davecavins.com/2009/12/displaying-document-titles-as-links/' rel='bookmark' title='Displaying document titles as links.'>Displaying document titles as links.</a></li>
<li><a href='http://davecavins.com/2011/11/some-thought-on-sharepoint-adoption/' rel='bookmark' title='Some thoughts on #SharePoint Adoption'>Some thoughts on #SharePoint Adoption</a></li>
<li><a href='http://davecavins.com/2009/12/updating-the-people-picker/' rel='bookmark' title='Updating the People Picker'>Updating the People Picker</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://davecavins.com/2011/03/spd-custom-activities-risks/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A Better Annoucements Ticker</title>
		<link>http://davecavins.com/2010/08/a-better-annoucements-ticker/</link>
		<comments>http://davecavins.com/2010/08/a-better-annoucements-ticker/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 21:08:14 +0000</pubDate>
		<dc:creator>davecavins</dc:creator>
				<category><![CDATA[General SharePoint]]></category>
		<category><![CDATA[SharePoint Design]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Data View Web Part]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint Designer]]></category>
		<category><![CDATA[ticker]]></category>
		<category><![CDATA[xsl]]></category>

		<guid isPermaLink="false">http://davecavins.com/?p=540</guid>
		<description><![CDATA[A while back I did a post about how to make a vertical news ticker, in the comments several people pointed out problems with the code so I decided to write a better version of the code. Here it is. For this ticker I started out with a default Annoucements list. Because I wanted to [...]


Related posts:<ol><li><a href='http://davecavins.com/2010/04/anything-slider-in-sharepoint-update/' rel='bookmark' title='Anything Slider in SharePoint &#8211; Update'>Anything Slider in SharePoint &#8211; Update</a></li>
<li><a href='http://davecavins.com/2010/11/zoomable-photo-grid/' rel='bookmark' title='Zoomable Photo Grid'>Zoomable Photo Grid</a></li>
<li><a href='http://davecavins.com/2009/12/css-tricks-anythingslider-in-sharepoint/' rel='bookmark' title='CSS-Tricks AnythingSlider in SharePoint'>CSS-Tricks AnythingSlider in SharePoint</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>A while back I did a post about <a href="http://davecavins.com/2009/11/sharepoint-vertical-news-ticker/">how to make a vertical news ticker</a>, in the comments several people pointed out problems with the code so I decided to write a better version of the code. Here it is.</p>
<div id="attachment_550" class="wp-caption alignnone" style="width: 466px"><a href="http://davecavins.com/wp-content/uploads/2010/08/ticker.jpg"><img class="size-full wp-image-550   " title="ticker" src="http://davecavins.com/wp-content/uploads/2010/08/ticker.jpg" alt="" width="456" height="447" /></a><p class="wp-caption-text">New Ticker</p></div>
<p>For this ticker I started out with a default Annoucements list. Because I wanted to display a thumbnail for each annoucement I added a signle line of text column called <strong>Subtitle </strong>and a Picture column called <strong>Picture</strong>. Here are the columns I used.<br />
<img class="alignnone size-full wp-image-546" title="columns" src="http://davecavins.com/wp-content/uploads/2010/07/columns.jpg" alt="List Columns" width="399" height="221" /></p>
<p>Here is the basic structure of the ticker.</p>
<pre class="brush: plain; title: ; notranslate">
&lt;div id=&quot;actions&quot;&gt;
&lt;a class=&quot;prev&quot;&gt;« Back&lt;/a&gt;	&lt;a class=&quot;next&quot;&gt;More pictures »&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;scrollable vertical&quot;&gt;
    &lt;div class=&quot;items&quot;&gt;
      &lt;div class=&quot;item&quot;&gt;
           &lt;img src=&quot;#&quot; alt=&quot;Thumbnail Image&quot; /&gt;
           &lt;h3&gt;Title&lt;/h3&gt;
          &lt;strong&gt;
              &lt;span&gt;Subtitle Text&lt;/span&gt;
          &lt;/strong&gt;
        &lt;p&gt;First 200 Characters of the body&lt;/p&gt;
       &lt;p&gt;&lt;a href=&quot;#&quot;&gt;Read more&lt;/a&gt;&lt;/p&gt;
    &lt;/div&gt;
   &lt;/div&gt;
&lt;/div&gt;
</pre>
<p>Below is the xsl code I used to build the ticker. </p>
<pre class="brush: plain; title: ; notranslate">

&lt;Xsl&gt;
&lt;xsl:stylesheet xmlns:x=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:d=&quot;http://schemas.microsoft.com/sharepoint/dsp&quot; version=&quot;1.0&quot; exclude-result-prefixes=&quot;xsl msxsl ddwrt&quot; xmlns:ddwrt=&quot;http://schemas.microsoft.com/WebParts/v2/DataView/runtime&quot; xmlns:asp=&quot;http://schemas.microsoft.com/ASPNET/20&quot; xmlns:__designer=&quot;http://schemas.microsoft.com/WebParts/v2/DataView/designer&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot; xmlns:msxsl=&quot;urn:schemas-microsoft-com:xslt&quot; xmlns:SharePoint=&quot;Microsoft.SharePoint.WebControls&quot; xmlns:ddwrt2=&quot;urn:frontpage:internal&quot;&gt;
	&lt;xsl:output method=&quot;html&quot; indent=&quot;no&quot;/&gt;
	&lt;xsl:decimal-format NaN=&quot;&quot;/&gt;
				&lt;xsl:param name=&quot;dvt_apos&quot;&gt;'&lt;/xsl:param&gt;
				&lt;xsl:param name=&quot;url_PATH_INFO&quot; /&gt;
				&lt;xsl:param name=&quot;url_HTTP_HOST&quot; /&gt;
	&lt;xsl:param name=&quot;Today&quot;&gt;CurrentDate&lt;/xsl:param&gt;
				&lt;xsl:variable name=&quot;dvt_1_automode&quot;&gt;0&lt;/xsl:variable&gt;
				&lt;xsl:template match=&quot;/&quot; xmlns:x=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:d=&quot;http://schemas.microsoft.com/sharepoint/dsp&quot; xmlns:asp=&quot;http://schemas.microsoft.com/ASPNET/20&quot; xmlns:__designer=&quot;http://schemas.microsoft.com/WebParts/v2/DataView/designer&quot; xmlns:SharePoint=&quot;Microsoft.SharePoint.WebControls&quot;&gt;
					&lt;xsl:call-template name=&quot;dvt_1&quot;/&gt;
	&lt;/xsl:template&gt;
				&lt;xsl:template name=&quot;dvt_1&quot;&gt;
					&lt;xsl:variable name=&quot;dvt_StyleName&quot;&gt;Table&lt;/xsl:variable&gt;
					&lt;xsl:variable name=&quot;Rows&quot; select=&quot;/dsQueryResponse/Rows/Row&quot;/&gt;
						&lt;script&gt;
$(function() {
	$(&quot;.scrollable&quot;).scrollable({ vertical: true, mousewheel: true, circular: true, keyboard: true });
// scrollable has to match the class on the div you use to wrap your items.
});
&lt;/script&gt; &lt;div id=&quot;actions&quot;&gt;
	&lt;a class=&quot;prev&quot;&gt;« Back&lt;/a&gt;
	&lt;a class=&quot;next&quot;&gt;More pictures »&lt;/a&gt;
&lt;/div&gt;
		&lt;div class=&quot;scrollable vertical&quot;&gt;
		&lt;div class=&quot;items&quot;&gt;
			&lt;xsl:call-template name=&quot;dvt_1.body&quot;&gt;
				&lt;xsl:with-param name=&quot;Rows&quot; select=&quot;$Rows&quot;/&gt;
			&lt;/xsl:call-template&gt;
			&lt;/div&gt;
			&lt;/div&gt;
	&lt;/xsl:template&gt;
				&lt;xsl:template name=&quot;dvt_1.body&quot;&gt;
					&lt;xsl:param name=&quot;Rows&quot;/&gt;
					&lt;xsl:for-each select=&quot;$Rows&quot;&gt;
						&lt;xsl:call-template name=&quot;dvt_1.rowview&quot;/&gt;
		&lt;/xsl:for-each&gt;
	&lt;/xsl:template&gt;
		&lt;xsl:template name=&quot;dvt_1.rowview&quot;&gt;
		&lt;div class=&quot;item&quot;&gt;
		&lt;xsl:if test=&quot;not(normalize-space(@Picture) = '')&quot;&gt;&lt;img src=&quot;{substring-before(@Picture,',')}&quot; /&gt;&lt;/xsl:if&gt;
		&lt;h3&gt;&lt;xsl:value-of select=&quot;@Title&quot;/&gt;&lt;/h3&gt;

				&lt;strong&gt;
		&lt;xsl:if test=&quot;not(normalize-space(@SubTitle) = '')&quot;&gt;&lt;span&gt;&lt;xsl:value-of select=&quot;@SubTitle &quot; disable-output-escaping=&quot;yes&quot; /&gt;&lt;/span&gt;&lt;/xsl:if&gt;
		&lt;/strong&gt;

				&lt;p&gt;&lt;xsl:value-of select=&quot;substring(@Body,0,200)&quot; disable-output-escaping=&quot;yes&quot; /&gt;&lt;/p&gt;
				&lt;p&gt;&lt;a href=&quot;http://{$url_HTTP_HOST}/{@FileDirRef}/DispForm.aspx?id={@ID}&quot;&gt;Read more&lt;/a&gt;&lt;/p&gt;
		&lt;/div&gt;
	&lt;/xsl:template&gt;
&lt;/xsl:stylesheet&gt;&lt;/Xsl&gt;
</pre>
<p>If you try to run the page with just this XSL it will give an error. You will also need to add these two lines to the parameter bindings section of your dataview web part. I used these 2 parameters to get the URL of the current page in order to built the &#8216;read more&#8217; link. This is what I would call a best practice because other wise you would have to hard code the URL to your site which makes it harder for others to use your code.</p>
<pre class="brush: plain; title: ; notranslate">
&lt;ParameterBinding Name=&quot;url_PATH_INFO&quot; Location=&quot;ServerVariable(PATH_INFO)&quot; DefaultValue=&quot;&quot;/&gt;&lt;ParameterBinding Name=&quot;url_HTTP_HOST&quot; Location=&quot;ServerVariable(HTTP_HOST)&quot; DefaultValue=&quot;&quot;/&gt;
</pre>
<p> In addition to this code you will also need to add links to these two files.</p>
<pre class="brush: plain; title: ; notranslate">
&lt;script src=&quot;http://cdn.jquerytools.org/1.2.3/jquery.tools.min.js&quot;&gt;&lt;/script&gt;
/* css file to style the ticker */
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;scroll.css&quot; /&gt;
</pre>
<p>Here is the css I used to style my ticker.</p>
<pre class="brush: css; title: ; notranslate">
/* root element for scrollable */
.vertical {
	/* required settings */
	position:relative;
	overflow:hidden;
	/* vertical scrollers have typically larger height than width */
	height: 665px;
	width: 700px;
	border-top:1px solid #ddd;
}

/* root element for scrollable items */
.items {
	position:absolute;
	/* this time we have very large space for height */
	height:20000em;	margin: 0px;
}

/* single scrollable item */
.item {
	border-bottom:1px solid #85b1ee;
	border-top:1px solid #85b1ee;
	margin:10px 0; padding:15px; font-size:12px;
	height:180px; background:#d6e8ff;
}

/* elements inside single item */
.item img {
	float:left;
	margin-right:20px;
	height:180px;
	width:240px;
	border:5px solid #fff;
}

.item h3 {
	margin:0 0 5px 0;
	font-size:16px;
	color:#4a6499;
	font-weight:normal;
}

.item p a{padding:3px;}

.item p a:hover{ background:#fff; text-decoration:none;}

.item p { padding:3px; margin:5px;}

/* the action buttons above the scrollable */
#actions { width:700px; margin:30px 0 10px 0;}

#actions a {font-size:11px;	cursor:pointer; color:#666;}

#actions a:hover {text-decoration:underline; color:#000;}

.disabled {visibility:hidden;}

.next {float:right;}
</pre>
<h2>Notes</h2>
<ul>
<li>The XSL is setup so that if no thumbnail is provided it will automatically adjust. The same is true if no subtitle is entered.  This is done using conditional formating.</li>
<li>Only the first 200 characters of the body are shown. To change this amount you can just change this line of code <strong>xsl:value-of select=&#8221;substring(@Body,0,200)&#8221;. </strong></li>
<li>You do not need the whole jQuery library in order for this to run.</li>
</ul>
<p> </p>
<p><strong> </strong> </p>
<h2>Resources</h2>
<ul>
<li><a href="http://plugins.jquery.com/project/scrollable" target="_blank">jQuery Scrollable Plugin<br />
</a>http://plugins.jquery.com/project/scrollable</li>
<li><a href="http://www.jwc3.net/2008/05/how-to-get-url-in-xsl.html">How to get the Current URL in XSL</a>
<p>http://www.jwc3.net/2008/05/how-to-get-url-in-xsl.html</li>
</ul>


<p>Related posts:<ol><li><a href='http://davecavins.com/2010/04/anything-slider-in-sharepoint-update/' rel='bookmark' title='Anything Slider in SharePoint &#8211; Update'>Anything Slider in SharePoint &#8211; Update</a></li>
<li><a href='http://davecavins.com/2010/11/zoomable-photo-grid/' rel='bookmark' title='Zoomable Photo Grid'>Zoomable Photo Grid</a></li>
<li><a href='http://davecavins.com/2009/12/css-tricks-anythingslider-in-sharepoint/' rel='bookmark' title='CSS-Tricks AnythingSlider in SharePoint'>CSS-Tricks AnythingSlider in SharePoint</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://davecavins.com/2010/08/a-better-annoucements-ticker/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Switch Themes Without a Page Refresh: Part 2</title>
		<link>http://davecavins.com/2010/06/switch-styles-in-sharepoint-with-jquery/</link>
		<comments>http://davecavins.com/2010/06/switch-styles-in-sharepoint-with-jquery/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 14:50:09 +0000</pubDate>
		<dc:creator>davecavins</dc:creator>
				<category><![CDATA[General SharePoint]]></category>
		<category><![CDATA[SharePoint Design]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint Designer]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://davecavins.com/?p=506</guid>
		<description><![CDATA[ So in part one of this post we got all the CSS and other theme file we needed to stuck them in a document library. With JavaScript you can change the CSS file a page uses without requiring a page refresh.  I have used this technique many times on non-SharePoint sites but there are some [...]


Related posts:<ol><li><a href='http://davecavins.com/2010/06/switch-themes-without-a-page-refresh-part-1/' rel='bookmark' title='Switch Themes Without a Page Refresh: Part 1'>Switch Themes Without a Page Refresh: Part 1</a></li>
<li><a href='http://davecavins.com/2009/07/annoucement-slider-using-web-services/' rel='bookmark' title='Annoucements Slider using SP Web Services'>Annoucements Slider using SP Web Services</a></li>
<li><a href='http://davecavins.com/2010/04/switch-list-displays-with-jquery-and-css/' rel='bookmark' title='Switch List Displays with JQuery and CSS'>Switch List Displays with JQuery and CSS</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p> So in <a href="http://davecavins.com/2010/06/switch-themes-without-a-page-refresh-part-1/" target="_blank">part one of this post </a>we got all the CSS and other theme file we needed to stuck them in a document library.</p>
<p>With JavaScript you can change the CSS file a page uses without requiring a page refresh.  I have used this technique many times on non-SharePoint sites but there are some special challenges implementing this in SharePoint.  Most of the scripts I have used in the past use the <a href="http://www.alistapart.com/articles/alternate/" target="_blank">alternate style sheet method as describred by A List Apart here</a>. That method works fine but I had to find another way because I was already using that script to allow users to change the font size. After some research I found <a href="http://www.cssnewbie.com/example/stylesheet-switcher/" target="_blank">this script from CSS Newbie</a> that worked pretty well without using alternate style sheets.</p>
<h2>The problem</h2>
<p>While the script works just fine on regular HTML pages it cause problems in SharePoint here is why :</p>
<pre class="brush: jscript; title: ; notranslate"> $(&quot;link&quot;).attr(&quot;href&quot;,$(this).attr('rel')); </pre>
<p>This line of code basically finds all the linked CSS files in the page and changes thier value to point to the new style sheet you select.  This is fine on a site that just uses one CSS file but in SharePoint bad things happen.  In most cases we dont want to completely remove the reference to core.css. For most themes many elements don&#8217;t need to be changed so we only have to write the CSS to change them and let core.css do the rest.  If you remove core.css its like using a global reset (<a href="http://www.visual28.com/articles/css-reset" target="_blank">discussed in more detail here</a>) which means you will have to restyle everything.  So them point is we want to leave core.css in the page and just add our theme. </p>
<p>To do this I had to make some changes to the master page to create to interface users will use to swap themes. </p>
<p><span id="more-506"></span></p>
<h2>Edit the Masterpage</h2>
<p>Here is the code I added to the masterpage. This can be styled to look however you want and can be added anywhere in the page that makes sense.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;ul&gt;
	&lt;li&gt;&lt;a rel=&quot;&quot; href=&quot;#&quot;&gt;Reset CSS&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a rel=&quot;/Site Styles/Verdant/theme.css&quot; href=&quot;#&quot;&gt;Verdant&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a rel=&quot;/Site Styles/Belltown/theme.css&quot; href=&quot;#&quot;&gt;Belltown&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a rel=&quot;/Site Styles/Petal/theme.css&quot; href=&quot;#&quot;&gt;Petal&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</pre>
<p>In addition to this we also need to add a link to our css file to the master page. I put it at the end of the head section.  </p>
<pre class="brush: xml; title: ; notranslate"> &lt;link class=&quot;altStyle&quot; href=&quot;&quot; type=&quot;text/css&quot; rel=&quot;stylesheet&quot;/&gt;</pre>
<p>I added a class to the link so that we can use jQuery to target only that css link and change it to match the theme the user selects. Initially I left the href value blank but if you want to apply some default styles you would just add the link to the css file there.</p>
<h2>Use jQuery to Swap the CSS</h2>
<p>So here is the code I used to swap the stylesheet. The main thing I changed is on lines 7 and 12.  I changed the selector so it will only target &lt;link&gt; tags with a class of &#8216;altStyle&#8217;.  This allows us to swap themes without breaking the link to core.css.</p>
<pre class="brush: jscript; title: ; notranslate"> &lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;

&lt;script src=&quot;cookie.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt; 

&lt;script type=&quot;text/javascript&quot;&gt;// &lt;![CDATA[
 if($.cookie(&quot;css&quot;)) {
 $(&quot;link.altStyle&quot;).attr(&quot;href&quot;,$.cookie(&quot;css&quot;));
 }
$(document).ready(function() {
//alert( $.cookie(&quot;css&quot;) );
 $(&quot;#nav li a&quot;).click(function() {
 $(&quot;link.altStyle&quot;).attr(&quot;href&quot;,$(this).attr('rel'));
 $.cookie(&quot;css&quot;,$(this).attr('rel'), {expires: 365, path: '/'});
 return false;
 });
});
// ]]&gt;&lt;/script&gt;
</pre>
<h2>Resources</h2>
<ul>
<li>You will need jQuery either locally or linked from Google.  Just update the link on line 1 as needed.</li>
<li>In the code above you will notice a link to <strong>cookie.js</strong>, this is the jQjuery cookie plugin that you will need in order to save users&#8217; theme selections.  In the code above on line 13 you will see where I create a cookie named css.  For testing purposes you can uncomment line 10 to see what the cookie value is on page load.   You can download the plugin from here.  <a href="http://plugins.jquery.com/project/cookie" target="_blank">jQuery Cookie Plugin</a></li>
<li>You can see the original code I started from in <a href="http://www.cssnewbie.com/example/stylesheet-switcher/" target="_blank">this script from CSS Newbie</a></li>
</ul>
<h2>Conclusion</h2>
<p>While this is a very simple solution it is a quick way to add in some fuctionality that many users want without alot of custom code or requiring the user to navigate to multiple pages.  Users like to feel that they have some control over the site (even if its just changing the color).  Feel free to post any questions or comments.</p>


<p>Related posts:<ol><li><a href='http://davecavins.com/2010/06/switch-themes-without-a-page-refresh-part-1/' rel='bookmark' title='Switch Themes Without a Page Refresh: Part 1'>Switch Themes Without a Page Refresh: Part 1</a></li>
<li><a href='http://davecavins.com/2009/07/annoucement-slider-using-web-services/' rel='bookmark' title='Annoucements Slider using SP Web Services'>Annoucements Slider using SP Web Services</a></li>
<li><a href='http://davecavins.com/2010/04/switch-list-displays-with-jquery-and-css/' rel='bookmark' title='Switch List Displays with JQuery and CSS'>Switch List Displays with JQuery and CSS</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://davecavins.com/2010/06/switch-styles-in-sharepoint-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Anything Slider in SharePoint &#8211; Update</title>
		<link>http://davecavins.com/2010/04/anything-slider-in-sharepoint-update/</link>
		<comments>http://davecavins.com/2010/04/anything-slider-in-sharepoint-update/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 17:49:05 +0000</pubDate>
		<dc:creator>davecavins</dc:creator>
				<category><![CDATA[SharePoint Design]]></category>
		<category><![CDATA[CSS-Tricks]]></category>
		<category><![CDATA[javasc]]></category>
		<category><![CDATA[SharePoint Designer]]></category>
		<category><![CDATA[slider]]></category>

		<guid isPermaLink="false">http://davecavins.com/?p=497</guid>
		<description><![CDATA[Several people have asked how to change the under of items displayed in the slider and how to change the sort order. Item Limit To change the number of items displayed use the code below. On line 13 change the RowLimit to the number of items you would like to show. For example if you [...]


Related posts:<ol><li><a href='http://davecavins.com/2010/11/zoomable-photo-grid/' rel='bookmark' title='Zoomable Photo Grid'>Zoomable Photo Grid</a></li>
<li><a href='http://davecavins.com/2009/12/css-tricks-anythingslider-in-sharepoint/' rel='bookmark' title='CSS-Tricks AnythingSlider in SharePoint'>CSS-Tricks AnythingSlider in SharePoint</a></li>
<li><a href='http://davecavins.com/2010/08/a-better-annoucements-ticker/' rel='bookmark' title='A Better Annoucements Ticker'>A Better Annoucements Ticker</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Several people have asked how to change the under of items displayed in the slider and how to change the sort order.</p>
<h2>Item Limit</h2>
<p>To change the number of items displayed use the code below.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;Xsl&gt;
&lt;xsl:stylesheet xmlns:x=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:d=&quot;http://schemas.microsoft.com/sharepoint/dsp&quot; version=&quot;1.0&quot; exclude-result-prefixes=&quot;xsl msxsl ddwrt&quot; xmlns:ddwrt=&quot;http://schemas.microsoft.com/WebParts/v2/DataView/runtime&quot; xmlns:asp=&quot;http://schemas.microsoft.com/ASPNET/20&quot; xmlns:__designer=&quot;http://schemas.microsoft.com/WebParts/v2/DataView/designer&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot; xmlns:msxsl=&quot;urn:schemas-microsoft-com:xslt&quot; xmlns:SharePoint=&quot;Microsoft.SharePoint.WebControls&quot; xmlns:ddwrt2=&quot;urn:frontpage:internal&quot;&gt;
	&lt;xsl:output method=&quot;html&quot; indent=&quot;no&quot;/&gt;
	&lt;xsl:decimal-format NaN=&quot;&quot;/&gt;
	&lt;xsl:param name=&quot;dvt_apos&quot;&gt;&amp;apos;&lt;/xsl:param&gt;
	&lt;xsl:variable name=&quot;dvt_1_automode&quot;&gt;0&lt;/xsl:variable&gt;
	&lt;xsl:template match=&quot;/&quot; xmlns:x=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:d=&quot;http://schemas.microsoft.com/sharepoint/dsp&quot; xmlns:asp=&quot;http://schemas.microsoft.com/ASPNET/20&quot; xmlns:__designer=&quot;http://schemas.microsoft.com/WebParts/v2/DataView/designer&quot; xmlns:SharePoint=&quot;Microsoft.SharePoint.WebControls&quot;&gt;
		&lt;xsl:call-template name=&quot;dvt_1&quot;/&gt;
	&lt;/xsl:template&gt;
	&lt;xsl:template name=&quot;dvt_1&quot;&gt;
		&lt;xsl:variable name=&quot;dvt_StyleName&quot;&gt;Table&lt;/xsl:variable&gt;
		&lt;xsl:variable name=&quot;Rows&quot; select=&quot;/dsQueryResponse/Rows/Row&quot; /&gt;
		&lt;xsl:variable name=&quot;RowLimit&quot; select=&quot;3&quot; /&gt;
		&lt;xsl:variable name=&quot;dvt_RowCount&quot; select=&quot;count($Rows)&quot; /&gt;
		&lt;xsl:variable name=&quot;IsEmpty&quot; select=&quot;$dvt_RowCount = 0&quot; /&gt;
		   &lt;link rel=&quot;stylesheet&quot; href=&quot;css/page.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;css/slider.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;
		&lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery.easing.1.2.js&quot;&gt;&lt;/script&gt; &lt;script src=&quot;js/jquery.anythingslider.js&quot; type=&quot;text/javascript&quot; charset=&quot;utf-8&quot;&gt;&lt;/script&gt; &lt;script type=&quot;text/javascript&quot;&gt;&lt;/script&gt; &lt;div class=&quot;anythingSlider&quot;&gt;
			&lt;div class=&quot;wrapper&quot;&gt;
		&lt;ul&gt;
			&lt;xsl:call-template name=&quot;dvt_1.body&quot;&gt;
				&lt;xsl:with-param name=&quot;Rows&quot; select=&quot;$Rows&quot; /&gt;
				&lt;xsl:with-param name=&quot;FirstRow&quot; select=&quot;1&quot; /&gt;
				&lt;xsl:with-param name=&quot;LastRow&quot; select=&quot;$RowLimit&quot; /&gt;
			&lt;/xsl:call-template&gt;
		&lt;/ul&gt;
		&lt;/div&gt;
        &lt;/div&gt;
	&lt;/xsl:template&gt;
	&lt;xsl:template name=&quot;dvt_1.body&quot;&gt;
		&lt;xsl:param name=&quot;Rows&quot; /&gt;
		&lt;xsl:param name=&quot;FirstRow&quot; /&gt;
		&lt;xsl:param name=&quot;LastRow&quot; /&gt;
		&lt;xsl:for-each select=&quot;$Rows&quot;&gt;
			&lt;xsl:variable name=&quot;dvt_KeepItemsTogether&quot; select=&quot;false()&quot; /&gt;
			&lt;xsl:variable name=&quot;dvt_HideGroupDetail&quot; select=&quot;false()&quot; /&gt;
			&lt;xsl:if test=&quot;(position() &amp;gt;= $FirstRow and position() &amp;lt;= $LastRow) or $dvt_KeepItemsTogether&quot;&gt;
				&lt;xsl:if test=&quot;not($dvt_HideGroupDetail)&quot; ddwrt:cf_ignore=&quot;1&quot;&gt;
					&lt;xsl:call-template name=&quot;dvt_1.rowview&quot; /&gt;
				&lt;/xsl:if&gt;
			&lt;/xsl:if&gt;
		&lt;/xsl:for-each&gt;
	&lt;/xsl:template&gt;
	&lt;xsl:template name=&quot;dvt_1.rowview&quot;&gt;
		&lt;li&gt;
		&lt;div class=&quot;textSlide&quot;&gt;
			&lt;h3&gt;&lt;a href=&quot;/{@FileDirRef}/DispForm.aspx?ID={@ID}&quot; title=&quot;{@Title}&quot;&gt;&lt;xsl:value-of select=&quot;@Title&quot; /&gt;&lt;/a&gt;&lt;/h3&gt;
			&lt;xsl:value-of select=&quot;@Body&quot; disable-output-escaping=&quot;yes&quot; /&gt;
		&lt;/div&gt;
		&lt;/li&gt;&lt;/xsl:template&gt;
	&lt;/xsl:stylesheet&gt;
&lt;/Xsl&gt;
</pre>
<p>On line 13 change the <strong>RowLimit</strong> to the number of items you would like to show. For example if you wanted to show 6 items you would change line 13 to this</p>
<pre class="brush: plain; title: ; notranslate">
&lt;xsl:variable name=&quot;RowLimit&quot; select=&quot;6&quot; /&gt;
</pre>
<h2>Sort Order</h2>
<p>Changing the sort order can be done through SharePoint Designer once you are using the updated code</p>
<ul>
<li>Click on the arrow to show the common data view tasks.</li>
<li>Click on &#8216;Sort and Group&#8217; the second option.</li>
<li>Make changes as needed.</li>
</ul>
<p>If dont want to do it that way there is another  option.</p>
<ul>
<li>Open the page in SharePoint Designer</li>
<li>In code view find this &#8216;SharePoint:SPDataSource&#8217; you will need to edit this tag.</li>
<li>Find the SelectCommand and add/edit the OrderBy attibute.</li>
<li>See the code below for an example. (Ordered by Created Date  in Ascending order). Its basically a CAML query.</li>
</ul>
<pre class="brush: plain; title: ; notranslate">
&lt;SharePoint:SPDataSource runat=&quot;server&quot; DataSourceMode=&quot;List&quot; SelectCommand=&quot;&amp;lt;View&amp;gt;&amp;lt;Query&amp;gt;&amp;lt;OrderBy&amp;gt;&amp;lt;FieldRef Name=&amp;quot;Created_x0020_Date&amp;quot; Ascending=&amp;quot;TRUE&amp;quot;/&amp;gt;&amp;lt;/OrderBy&amp;gt;&amp;lt;/Query&amp;gt;&amp;lt;/View&amp;gt;&quot;
</pre>
<p> If you are not sure how to get it all set up look to <a title="Anything Slider Post 1" href="http://davecavins.com/2009/12/css-tricks-anythingslider-in-sharepoint">my previous post on the Anything Slider</a>.  If you have questions please post a comment.</p>


<p>Related posts:<ol><li><a href='http://davecavins.com/2010/11/zoomable-photo-grid/' rel='bookmark' title='Zoomable Photo Grid'>Zoomable Photo Grid</a></li>
<li><a href='http://davecavins.com/2009/12/css-tricks-anythingslider-in-sharepoint/' rel='bookmark' title='CSS-Tricks AnythingSlider in SharePoint'>CSS-Tricks AnythingSlider in SharePoint</a></li>
<li><a href='http://davecavins.com/2010/08/a-better-annoucements-ticker/' rel='bookmark' title='A Better Annoucements Ticker'>A Better Annoucements Ticker</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://davecavins.com/2010/04/anything-slider-in-sharepoint-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Displaying document titles as links.</title>
		<link>http://davecavins.com/2009/12/displaying-document-titles-as-links/</link>
		<comments>http://davecavins.com/2009/12/displaying-document-titles-as-links/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 16:23:33 +0000</pubDate>
		<dc:creator>davecavins</dc:creator>
				<category><![CDATA[General SharePoint]]></category>
		<category><![CDATA[Document Library]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint Designer]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://davecavins.com/?p=367</guid>
		<description><![CDATA[On a recent project I had to migrate a large number of documents from a legacy system into SharePoint. In the old system users to choose what text would be displayed as the link. In most cases users chose not to use the actual file name as the link text. The Problem In SharePoint users [...]


Related posts:<ol><li><a href='http://davecavins.com/2011/12/block-multi-document-uploads-in-sharepoint/' rel='bookmark' title='Block multi-document uploads in #SharePoint'>Block multi-document uploads in #SharePoint</a></li>
<li><a href='http://davecavins.com/2009/07/annoucement-slider-using-web-services/' rel='bookmark' title='Annoucements Slider using SP Web Services'>Annoucements Slider using SP Web Services</a></li>
<li><a href='http://davecavins.com/2009/11/slideshow-with-captions/' rel='bookmark' title='Image Slideshow with captions'>Image Slideshow with captions</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>On a recent project I had to migrate a large number of documents from a legacy system into SharePoint. In the old system users to choose what text would be displayed as the link. In most cases users chose not to use the actual file name as the link text.</p>
<h2>The Problem</h2>
<p>In SharePoint users don’t have as much control of what gets displayed. There is a &#8216;Title&#8217; field but it can’t be used in a calculated column and on the standard document library it is not a required field.</p>
<p>Technically the file name could be used but this could lead to very long file names with spaces and special characters that could cause problems by forcing the page to scroll as well as creating some REALLY long URLs.</p>
<p>Depending on the type of document the actual file name may be irrelevant to the use while the title would be more helpful. For instance a in document library of meeting minutes the file names could just be the date of the meeting for example (12_03_2009.docx). The document title could be used to contain not only the date but other relevant information about the meeting like who attended or important issues that were discussed. Additionally the title field can support special characters and spaces that could be a problem in file names.</p>
<p><span id="more-367"></span></p>
<h2>My Solution</h2>
<p>I added two new columns to the Document Library.</p>
<ul>
<li>“DocSrc” &#8211; a plain text column to hold the path to the document.</li>
<li>“Title Link” &#8211; a calculated column to create the link (I will explain this later).</li>
</ul>
<p>First we need make sure our documents have titles.</p>
<p><strong>Here is how to add Titles to a document in Word 2007:</strong><br />
Click on the ‘orb’ and choose “Prepare” &gt; “Properties”<br />
<img class="aligncenter size-full wp-image-377" title="title1" src="http://davecavins.com/wp-content/uploads/2009/12/title1.jpg" alt="title1" width="428" height="324" /><br />
In the pane that opens you can enter in a title and other Meta data.<br />
<img class="aligncenter size-full wp-image-378" title="title2" src="http://davecavins.com/wp-content/uploads/2009/12/title2.jpg" alt="title2" width="552" height="199" /></p>
<p>Now if a user uploads a document without a title we need to let them know and ask them to add a title.</p>
<p>Next I created a simple SharePoint Designer workflow, here is how.<br />
Create a new workflow in SharePoint Designer and give it a name. On the first screen I checked these two boxes:</p>
<div id="attachment_379" class="wp-caption aligncenter" style="width: 378px"><img class="size-full wp-image-379" title="wf1" src="http://davecavins.com/wp-content/uploads/2009/12/wf1.jpg" alt="Allow the workflow to be started manually." width="368" height="89" /><p class="wp-caption-text">Allow the workflow to be started manually.</p></div>
<p>This is because we want the workflow to run for new items but just in case some items have already been loaded in the library we need to be able to run the workflow on them as well. In step 1 of the workflow I check to see if the “Title” field is empty, if it is not I copy the value from the “URL Path” field into my “DocSrc” field. I also added a condition so that if there is nothing in the “Title” field the workflow will email the user and ask them to add a title. In the body of the email I provide a link to the document. That’s all we need for the workflow.</p>
<p><img class="aligncenter size-full wp-image-381" title="wf5" src="http://davecavins.com/wp-content/uploads/2009/12/wf4.jpg" alt="wf5" width="430" height="239" /><br />
 </p>
<h2>Building the link</h2>
<p>So now we have the title of the document and the URL of the document we can build our link in the “Title Link” column. We need to create a formula in the “Title Link” column that will create a link to our document and use the title as the displayed text.<br />
In the “Title Link” column we just need to put the following text:</p>
<pre class="brush: plain; title: ; notranslate">=CONCATENATE(&quot;&lt;a href=&quot;',[DocSrc],'&quot;&gt;&quot;,[Title],&quot;&lt;/a&gt;&quot;)</pre>
<p>Next we just need to make the html code display properly using <a rel="nofollow" href="http://www.pathtosharepoint.com/HTMLcc/default.aspx ">this script from Path to SharePoint</a>.</p>
<p>Now users can see meaningful titles for thier documents without having to decifer complex document names and they will still have access to see the document name with the dropdown menu.</p>
<p> <img class="aligncenter size-full wp-image-381" title="wf5" src="http://davecavins.com/wp-content/uploads/2009/12/wf5.jpg" alt="wf5" width="369" height="188" /></p>
<p>When it comes to document management and getting new SharePoint users on board things like this are important in helping them feel more comfortable. If you dont take steps to make the system suit the users needs they are more likely to just use SharePoint as a new shared drive and just dump all their documents into a library that never get used.</p>
<p>Has anyone else dealt with this type issue? What was your solution?</p>


<p>Related posts:<ol><li><a href='http://davecavins.com/2011/12/block-multi-document-uploads-in-sharepoint/' rel='bookmark' title='Block multi-document uploads in #SharePoint'>Block multi-document uploads in #SharePoint</a></li>
<li><a href='http://davecavins.com/2009/07/annoucement-slider-using-web-services/' rel='bookmark' title='Annoucements Slider using SP Web Services'>Annoucements Slider using SP Web Services</a></li>
<li><a href='http://davecavins.com/2009/11/slideshow-with-captions/' rel='bookmark' title='Image Slideshow with captions'>Image Slideshow with captions</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://davecavins.com/2009/12/displaying-document-titles-as-links/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Styling SharePoint Blog Comments: Part 2</title>
		<link>http://davecavins.com/2009/10/sharepoint-blog-comments-p2/</link>
		<comments>http://davecavins.com/2009/10/sharepoint-blog-comments-p2/#comments</comments>
		<pubDate>Fri, 16 Oct 2009 14:00:45 +0000</pubDate>
		<dc:creator>davecavins</dc:creator>
				<category><![CDATA[SharePoint Design]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint Designer]]></category>

		<guid isPermaLink="false">http://davecavins.com/?p=269</guid>
		<description><![CDATA[As promised I went ahead and styled the comment form on a standard SharePoint blog.  I wanted to make it look better than this but there are some limitations because of the way the page is coded with so many nested tables.  I kept the styles pretty simple but this should be a good starting [...]


Related posts:<ol><li><a href='http://davecavins.com/2009/10/styling-sharepoint-blog-comments/' rel='bookmark' title='Styling SharePoint Blog Comments'>Styling SharePoint Blog Comments</a></li>
<li><a href='http://davecavins.com/2009/07/styling-the-moss-horizontal-navigation-menu/' rel='bookmark' title='Styling the MOSS horizontal navigation menu'>Styling the MOSS horizontal navigation menu</a></li>
<li><a href='http://davecavins.com/2010/04/switch-list-displays-with-jquery-and-css/' rel='bookmark' title='Switch List Displays with JQuery and CSS'>Switch List Displays with JQuery and CSS</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://davecavins.com/2009/10/styling-sharepoint-blog-comments/">As promised</a> I went ahead and styled the comment form on a standard SharePoint blog.  I wanted to make it look better than this but there are some limitations because of the way the page is coded with so many nested tables. </p>
<div id="attachment_270" class="wp-caption aligncenter" style="width: 522px"><img class="size-full wp-image-270" title="blog" src="http://davecavins.com/wp-content/uploads/2009/10/blog.jpg" alt="Better looking comment form" width="512" height="470" /><p class="wp-caption-text">Better looking comment form</p></div>
<p>I kept the styles pretty simple but this should be a good starting point for someone wanting to do something more complex.<br />
<span id="more-269"></span><br />
This code includes the <a href="http://davecavins.com/2009/10/styling-sharepoint-blog-comments/">code from part 1</a> with some minor changes. The new styles for the comment form are commented.</p>
<pre class="brush: css; title: ; notranslate">
&lt;style type=&quot;text/css&quot;&gt;
.ms-commenttable td {border:0px;}
h4.ms-CommentTitle{border:0px; font:italic normal small Georgia;}
div.ms-CommentBody {
	background:url('../../images/comm_top.gif') top 0px no-repeat;
	margin-bottom:12px;
	padding:18px 0 0 0;
}
div.ms-CommentBody div {
	border:1px solid #ccc;
	border-top:0px;
	padding:15px;
	line-height:18px;
	}
.ms-CommentFooter {background:url('/_layouts/images/square.gif') 5px 50% no-repeat;
	padding:3px;
	margin:0px;
	border-top:1px dotted #ccc;
	border-bottom:1px dotted #ccc;
}
.ms-CommentFooter span {padding-left:18px;}
.ms-commentsWrapper {background:#fff; margin:5px; border:0px;}
.ms-blogedit a{	background:transparent; border:0px;}
.ms-blogedit a:hover{background:#ccc; border:0px;}
h3.ms-CommentHeader{padding-left:35px;
	background:url('/_layouts/images/menunewdiscussion.gif') top left no-repeat}
.ms-formtable {	border-top:1px dotted #ccc;	border-bottom:1px dotted #ccc;	padding:5px;}
/* cell holding the labels */
.ms-formlabel {	border:0px ;width:100px;}
/* label text */
.ms-formlabel h3.ms-standardheader{	padding-top:5px; font-weight:normal; text-align:right;}
/*wraps the form elements */
.ms-formbody {background:transparent;	border:0px;}
/* the title input field */
.ms-formbody span input{
background:#FEFFE2;
padding:2px 5px 1px 5px;
height:28px;
border:1px solid #ccc;
font:italic normal normal small/18px Arial;
margin:5px 0 5px 0;
}
/* text area for the comment body */
.ms-formbody span textarea{
font:italic normal normal small/18px Arial;
background:#FEFFE2;
padding:5px;
border:1px solid #ccc;
margin:0 0 5px 0;
}
/* submit button */
.ms-toolbar input.ms-ButtonHeightWidth2 {
	height:26px;
	border:2px solid #317A0C;
	background:#51AA25;
	color:#fff;
	font:italic normal x-small Georgia;
}
&lt;/style&gt;
</pre>
<p>Note: To be sure this code does not affect the styling of other forms on the page and other web parts it would be best to open the page in SharePoint Designer and wrap the web part in a div some the styles can be targeted to affect only items inside the div.</p>


<p>Related posts:<ol><li><a href='http://davecavins.com/2009/10/styling-sharepoint-blog-comments/' rel='bookmark' title='Styling SharePoint Blog Comments'>Styling SharePoint Blog Comments</a></li>
<li><a href='http://davecavins.com/2009/07/styling-the-moss-horizontal-navigation-menu/' rel='bookmark' title='Styling the MOSS horizontal navigation menu'>Styling the MOSS horizontal navigation menu</a></li>
<li><a href='http://davecavins.com/2010/04/switch-list-displays-with-jquery-and-css/' rel='bookmark' title='Switch List Displays with JQuery and CSS'>Switch List Displays with JQuery and CSS</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://davecavins.com/2009/10/sharepoint-blog-comments-p2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Styling SharePoint Blog Comments</title>
		<link>http://davecavins.com/2009/10/styling-sharepoint-blog-comments/</link>
		<comments>http://davecavins.com/2009/10/styling-sharepoint-blog-comments/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 20:36:19 +0000</pubDate>
		<dc:creator>davecavins</dc:creator>
				<category><![CDATA[General SharePoint]]></category>
		<category><![CDATA[SharePoint Design]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint Designer]]></category>

		<guid isPermaLink="false">http://davecavins.com/?p=257</guid>
		<description><![CDATA[Out of the box the comments on SharePoint blogs dont look that good.   Here is a way to fix that problem. Just add this CSS to the page and things should start looking alot better. Without editing the code of the page there are some limitations on what can be done. I did not make [...]


Related posts:<ol><li><a href='http://davecavins.com/2009/10/sharepoint-blog-comments-p2/' rel='bookmark' title='Styling SharePoint Blog Comments: Part 2'>Styling SharePoint Blog Comments: Part 2</a></li>
<li><a href='http://davecavins.com/2010/03/adding-comments-to-a-list-part-1/' rel='bookmark' title='Adding Comments to a List Part 1'>Adding Comments to a List Part 1</a></li>
<li><a href='http://davecavins.com/2009/07/styling-the-moss-horizontal-navigation-menu/' rel='bookmark' title='Styling the MOSS horizontal navigation menu'>Styling the MOSS horizontal navigation menu</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Out of the box the comments on SharePoint blogs dont look that good. </p>
<div id="attachment_258" class="wp-caption aligncenter" style="width: 274px"><a href="http://davecavins.com/wp-content/uploads/2009/10/comments_old.jpg"><img class="size-full wp-image-258" title="comments_old" src="http://davecavins.com/wp-content/uploads/2009/10/comments_old.jpg" alt="Standard SharePoint blog comments" width="264" height="228" /></a><p class="wp-caption-text">Standard SharePoint blog comments</p></div>
<p> Here is a way to fix that problem. Just add this CSS to the page and things should start looking alot better.<span id="more-257"></span></p>
<pre class="brush: css; title: ; notranslate">
&amp;amp;lt;style type=&amp;amp;quot;text/css&amp;amp;quot;&amp;amp;gt;
/* wraps the title of each comment */
.ms-commenttable {border:0px;}
/* the title of each comment */
h4.ms-CommentTitle{font-size:x-small;border:0px;}
/* wraps the body of each comment */
div.ms-CommentBody {
	background:url('../../images/comm_top.gif') top 0px no-repeat;
	margin-bottom:12px;
	padding:18px 0 0 0;
}
/* wraps the text of each comment */
div.ms-CommentBody div {
	border:1px solid #ccc;
	border-top:0px;
	padding:15px;
	line-height:18px;
	}
/* wraps the meta info (author, date, etc.)	for each comment */
.ms-CommentFooter {
	background:url('/_layouts/images/square.gif') 5px 50% no-repeat;
	padding:3px;
	margin:0px;
	border-top:1px dotted #ccc;
	border-bottom:1px dotted #ccc;
}
.ms-CommentFooter span {padding-left:18px;}

/* wraps all comments */
.ms-commentsWrapper {
	background:#fff;
	margin:5px;
	border:0px;
}
/* header style for 'Comments' and 'Add a Comment' */
h3.ms-CommentHeader{
	padding-left:35px;
	background:url('/_layouts/images/menunewdiscussion.gif') top left no-repeat
}
&amp;amp;lt;/style&amp;amp;gt;
</pre>
<p>Without editing the code of the page there are some limitations on what can be done. I did not make too many drastic changes but this code should be a good starting point for making your ShaerPoint blogs look better.</p>
<div id="attachment_256" class="wp-caption aligncenter" style="width: 422px"><img class="size-full wp-image-256" title="comments" src="http://davecavins.com/wp-content/uploads/2009/10/comments.jpg" alt="comments" width="412" height="384" /><p class="wp-caption-text">Better looking comments</p></div>
<p><a href="http://davecavins.com/wp-content/uploads/2009/10/comm_top.gif">Here is the image I used in the CSS</a> (right click save as). The other two images are referenced from the 12 hive and should work automatically on any WSS or MOSS installation. </p>
<p>In a future post I will try to do something about the comment form.</p>


<p>Related posts:<ol><li><a href='http://davecavins.com/2009/10/sharepoint-blog-comments-p2/' rel='bookmark' title='Styling SharePoint Blog Comments: Part 2'>Styling SharePoint Blog Comments: Part 2</a></li>
<li><a href='http://davecavins.com/2010/03/adding-comments-to-a-list-part-1/' rel='bookmark' title='Adding Comments to a List Part 1'>Adding Comments to a List Part 1</a></li>
<li><a href='http://davecavins.com/2009/07/styling-the-moss-horizontal-navigation-menu/' rel='bookmark' title='Styling the MOSS horizontal navigation menu'>Styling the MOSS horizontal navigation menu</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://davecavins.com/2009/10/styling-sharepoint-blog-comments/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Dynamic Drive&#8217;s Featured Content Slider in Sharepoint</title>
		<link>http://davecavins.com/2009/05/dynamic-drive-featured-content-slider-v24-in-sharepoint/</link>
		<comments>http://davecavins.com/2009/05/dynamic-drive-featured-content-slider-v24-in-sharepoint/#comments</comments>
		<pubDate>Tue, 12 May 2009 18:39:56 +0000</pubDate>
		<dc:creator>davecavins</dc:creator>
				<category><![CDATA[SharePoint Design]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[content slider]]></category>
		<category><![CDATA[dynamic drive]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint Designer]]></category>
		<category><![CDATA[xsl]]></category>

		<guid isPermaLink="false">http://davecavins.com/?p=11</guid>
		<description><![CDATA[I have used Dynamic Drive&#8217;s Featured Content Slider on a couple of recent projects and wanted to see if I could get it working in SharePoint. There were several key requirements: User can easily add items Users  can choose a style for each item Expired Items must not show Each item will have a Title, Body [...]


Related posts:<ol><li><a href='http://davecavins.com/2010/04/anything-slider-in-sharepoint-update/' rel='bookmark' title='Anything Slider in SharePoint &#8211; Update'>Anything Slider in SharePoint &#8211; Update</a></li>
<li><a href='http://davecavins.com/2009/12/css-tricks-anythingslider-in-sharepoint/' rel='bookmark' title='CSS-Tricks AnythingSlider in SharePoint'>CSS-Tricks AnythingSlider in SharePoint</a></li>
<li><a href='http://davecavins.com/2010/11/zoomable-photo-grid/' rel='bookmark' title='Zoomable Photo Grid'>Zoomable Photo Grid</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I have used <a href="http://www.dynamicdrive.com/dynamicindex17/featuredcontentslider.htm" target="_blank">Dynamic Drive&#8217;s Featured Content Slider</a> on a couple of recent projects and wanted to see if I could get it working in SharePoint. There were several key requirements:</p>
<ol>
<li>User can easily add items</li>
<li>Users  can choose a style for each item</li>
<li>Expired Items must not show</li>
<li>Each item will have a Title, Body and a customizable &#8220;read more&#8221; link.</li>
</ol>
<p>Here&#8217;s how I did it.</p>
<p><img class="alignnone size-full wp-image-155" title="slider" src="http://davecavins.com/wp-content/uploads/2009/05/slider.jpg" alt="slider" width="596" height="242" /> </p>
<p>First I created a custom list to store the slider items.  These are the columns I used:</p>
<p>Title &#8211; Single Line of text<br />
Body &#8211; Multiple Lines of text<br />
Link URL &#8211; HyperLink<br />
Expiration &#8211; Date and Time (expired items will not be shown)<br />
Image &#8211; Picture<br />
Style &#8211; Choice  (we will use this column to allow users to choose the style of each item)</p>
<p>On the page I used a DataView WebPart to display the Title, Body, Image and Link URL columns.   Using Sharepoint Designer I setup filtering on the expiration date.  To do this in design view right click on the data view webpart and bring up the &#8220;Common Data View Tasks &#8221; box and choose Filter.  In the window I set the conditional statement so that items would only be shown if the expiration date was greater than today.<span id="more-11"></span></p>
<p>You can find a basic tutorial on using the DVWP <a href="http://www.endusersharepoint.com/?p=1629" target="_blank">here</a></p>
<p>Once we have the data we want showing on the page we need to get it into the right format.  For the Content Slider to work properly the page needs to refernce an external JavaScript file and a CSS style sheet. Additionally the Slider itself has to follow this pattern:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;slider1&quot; class=&quot;sliderwrapper&quot;&gt;
&lt;div class=&quot;contentdiv&quot;&gt;Content 1 Here.
&lt;/div&gt;
&lt;div id=&quot;paginate-slider1&quot; class=&quot;pagination&quot;&gt;&lt;/div&gt;
</pre>
<p>Basically the whole content slider has do be wrapped in a div with an ID of &#8216;slider1&#8242;  each of the items must be wrapped in a div with the class &#8216;contentdiv&#8217;.  For more explanation on this <a href="http://www.dynamicdrive.com/dynamicindex17/featuredcontentslider.htm" target="_blank">visit Dynamic Drive</a></p>
<p>SharePoint uses xsl to style the data view so we have to go into the code view and add the nessecary Javascript, CSS and div elements to make everything work. Here is the xsl I used to get everything working in the page</p>
<pre class="brush: xml; title: ; notranslate">
&lt;Xsl&gt;
&lt;xsl:stylesheet xmlns:x=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:d=&quot;http://schemas.microsoft.com/sharepoint/dsp&quot; version=&quot;1.0&quot; exclude-result-prefixes=&quot;xsl msxsl ddwrt&quot; xmlns:ddwrt=&quot;http://schemas.microsoft.com/WebParts/v2/DataView/runtime&quot; xmlns:asp=&quot;http://schemas.microsoft.com/ASPNET/20&quot; xmlns:__designer=&quot;http://schemas.microsoft.com/WebParts/v2/DataView/designer&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot; xmlns:msxsl=&quot;urn:schemas-microsoft-com:xslt&quot; xmlns:SharePoint=&quot;Microsoft.SharePoint.WebControls&quot; xmlns:ddwrt2=&quot;urn:frontpage:internal&quot;&gt;
	&lt;xsl:output method=&quot;html&quot; indent=&quot;no&quot;/&gt;
	&lt;xsl:decimal-format NaN=&quot;&quot;/&gt;
	&lt;xsl:param name=&quot;dvt_apos&quot;&gt;&amp;apos;&lt;/xsl:param&gt;
	&lt;xsl:param name=&quot;Today&quot;&gt;CurrentDate&lt;/xsl:param&gt;
	&lt;xsl:variable name=&quot;dvt_1_automode&quot;&gt;0&lt;/xsl:variable&gt;
	&lt;xsl:template match=&quot;/&quot; xmlns:x=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:d=&quot;http://schemas.microsoft.com/sharepoint/dsp&quot; xmlns:asp=&quot;http://schemas.microsoft.com/ASPNET/20&quot; xmlns:__designer=&quot;http://schemas.microsoft.com/WebParts/v2/DataView/designer&quot; xmlns:SharePoint=&quot;Microsoft.SharePoint.WebControls&quot;&gt;
		&lt;xsl:call-template name=&quot;dvt_1&quot;/&gt;
	&lt;/xsl:template&gt;
	&lt;xsl:template name=&quot;dvt_1&quot;&gt;
		&lt;xsl:variable name=&quot;dvt_StyleName&quot;&gt;Table&lt;/xsl:variable&gt;
		&lt;xsl:variable name=&quot;Rows&quot; select=&quot;/dsQueryResponse/Rows/Row&quot; /&gt;
		&lt;div id=&quot;slider1&quot; class=&quot;sliderwrapper&quot;&gt;
			&lt;xsl:call-template name=&quot;dvt_1.body&quot;&gt;
				&lt;xsl:with-param name=&quot;Rows&quot; select=&quot;$Rows&quot; /&gt;
			&lt;/xsl:call-template&gt;
		&lt;/div&gt;
		&lt;div id=&quot;paginate-slider1&quot; class=&quot;pagination&quot;&gt;
&lt;/div&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
featuredcontentslider.init({
	id: &quot;slider1&quot;,  //id of main slider DIV
	contentsource: [&quot;inline&quot;, &quot;&quot;],
	toc: &quot;#increment&quot;,  //Valid values: &quot;#increment&quot;, &quot;markup&quot;, [&quot;label1&quot;, &quot;label2&quot;, etc]
	nextprev: [&quot;Previous&quot;, &quot;Next&quot;],
	revealtype: &quot;click&quot;,
	enablefade: [true, 0.2],  //[true/false, fadedegree]
	autorotate: [true, 3000],  //[true/false, pausetime]
	onChange: function(previndex, curindex){  //event handler fired whenever script changes
		//previndex holds index of last slide viewed b4 current (1=1st slide, 2nd=2nd etc)
		//curindex holds index of currently shown slide (1=1st slide, 2nd=2nd etc)
	}
})
&lt;/script&gt; &lt;/xsl:template&gt;
	&lt;xsl:template name=&quot;dvt_1.body&quot;&gt;
		&lt;xsl:param name=&quot;Rows&quot; /&gt;
		&lt;xsl:for-each select=&quot;$Rows&quot;&gt;
			&lt;xsl:call-template name=&quot;dvt_1.rowview&quot; /&gt;
		&lt;/xsl:for-each&gt;
	&lt;/xsl:template&gt;
	&lt;xsl:template name=&quot;dvt_1.rowview&quot;&gt;
		&lt;div class=&quot;contentdiv&quot;&gt;
		&lt;div class=&quot;{@Style}&quot;&gt;
		&lt;img border=&quot;0&quot; align=&quot;left&quot; hspace=&quot;0&quot; vspace=&quot;0&quot; alt=&quot;{substring-after(@Image, ', ')}&quot; src=&quot;{substring-before(@Image, ', ')}&quot; /&gt;
	&lt;a href=&quot;{substring-before(@Link_x0020_URL, ', ')}&quot; title=&quot;{@Title}&quot;&gt;
	&lt;h1&gt;&lt;xsl:value-of select=&quot;@Title&quot; /&gt;&lt;/h1&gt;&lt;/a&gt;
	&lt;p&gt;&lt;xsl:value-of select=&quot;substring(@Body,1,330)&quot;/&gt;...&lt;/p&gt;
	&lt;a href=&quot;{substring-before(@Link_x0020_URL, ', ')}&quot; class=&quot;readMoreLink&quot; title=&quot;{substring-after(@Link_x0020_URL, ', ')}&quot;&gt;
	&lt;span class=&quot;readMoreIcon&quot;&gt;&lt;xsl:value-of select=&quot;substring-after(@Link_x0020_URL, ', ')&quot; /&gt;&lt;/span&gt;
	&lt;/a&gt;
	&lt;/div&gt;
	&lt;/div&gt;&lt;/xsl:template&gt;
&lt;/xsl:stylesheet&gt;
&lt;/Xsl&gt;
</pre>
<p>For information on how to write xsl stylesheets read <a href="http://www.heathersolomon.com/blog/articles/CustomItemStyle.aspx">this post</a> on Heather Solomon&#8217;s site. Basically using tags like this:<br />
allows you to insert various peices of data from the list. In the xsl above I am wrapping each item with the nessacary div to make the slider work. Inside each div I am inserting the title inside an h1 tag, the first 330 characters of the body in an a p tag, and the Link URL formatted as a Hyperlink.</p>
<p>To make everything look good I had to customize the CSS that comes from Dynamic Drive. The code is below.</p>
<pre class="brush: css; title: ; notranslate">
.sliderwrapper{
position: relative; /*leave as is*/
overflow: hidden; /*leave as is*/
border: 0px;
width: 100%; /*width of featured content slider*/
height: 231px;
}
.sliderwrapper .contentdiv{
visibility:hidden; /*leave as is*/
position:absolute; /*leave as is*/
left:0;  /*leave as is*/
top:0;  /*leave as is*/
padding: 0px;
background:#fff;
width:100%;
/*width of content DIVs within slider. Total width should equal slider's inner width (390+5+5=400) */
height:100%;
filter:progid:DXImageTransform.Microsoft.alpha(opacity=100);
-moz-opacity:1;
opacity:1;
color:#fff;
font-size:x-small;
}
.contentdiv img{
height:205px;
width:270px;
margin:10px;
border:1px solid #ccc;
}
.contentdiv h1{
color:#eee;
font:normal normal large Georgia;
margin:0px;
padding:5px 0 0 0;
line-height:20px
}
.contentdiv a:hover, .contentdiv a{
text-decoration:none !important;
padding:0px;
}
.contentdiv p{
line-height:19px;
padding:0px 10px 0px 10px;
}
a.readMoreLink {
color:#555;
padding:4px;
background-color:#fff;
}
a.readMoreLink:hover {
color:#555;
text-decoration:none;
padding:4px;
background:#fff url('link_bg.gif') repeat-x bottom center;
}
.pagination{
width: 100%;
/*Width of pagination DIV. Total width should equal slider's outer width (400+10+10=420)*/
text-align: right;
padding: 3px 1px;
font-size:x-small;
background:#fff url('link_bg.gif') repeat-x bottom center;
border-top:1px solid #ccc;
}
.pagination a{
padding: 0 4px;
text-decoration: none;
color: #666;
background:#fff;
}
.pagination a.selected{
color: #fff;
background-color: #666;
}
.pagination a:hover{
color:#fff;
background:#666;
text-decoration:none;
}
</pre>
<p>In the XSL stylesheet each item is wrapped in a div, the class name for the div is pulled from the &#8216;Style&#8217; column in the list. The make the styles work I added the following CSS to my stylesheet</p>
<pre class="brush: css; title: ; notranslate">
.Red_Style{
height:230px;
background:#671818 url('red_bg.gif') repeat-x top center;
}
.Blue_Style{
height:230px;
background:#3A5E97 url('blue_bg.gif') repeat-x top center;
}
.Green_Style{
height:230px;
background:#4E8822 url('green_bg.gif') repeat-x top center;
}
</pre>
<p>All I am doing is changing the background image and color for each style. Because the div wraps each item it would be possible to also change font colors, font size, image position and more but I just wanted to keep it simple.</p>
<p>The only drawback with using the dataview webpart is that this webpart cannot be easily moved from one site to another.</p>


<p>Related posts:<ol><li><a href='http://davecavins.com/2010/04/anything-slider-in-sharepoint-update/' rel='bookmark' title='Anything Slider in SharePoint &#8211; Update'>Anything Slider in SharePoint &#8211; Update</a></li>
<li><a href='http://davecavins.com/2009/12/css-tricks-anythingslider-in-sharepoint/' rel='bookmark' title='CSS-Tricks AnythingSlider in SharePoint'>CSS-Tricks AnythingSlider in SharePoint</a></li>
<li><a href='http://davecavins.com/2010/11/zoomable-photo-grid/' rel='bookmark' title='Zoomable Photo Grid'>Zoomable Photo Grid</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://davecavins.com/2009/05/dynamic-drive-featured-content-slider-v24-in-sharepoint/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Adding Suggestions to the Sharepoint search box</title>
		<link>http://davecavins.com/2009/04/adding-suggestiong-to-the-sharepoint-search-box/</link>
		<comments>http://davecavins.com/2009/04/adding-suggestiong-to-the-sharepoint-search-box/#comments</comments>
		<pubDate>Sun, 26 Apr 2009 20:10:41 +0000</pubDate>
		<dc:creator>davecavins</dc:creator>
				<category><![CDATA[SharePoint Design]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[SharePoint Designer]]></category>
		<category><![CDATA[suggestions]]></category>

		<guid isPermaLink="false">http://davecavins.com/?p=46</guid>
		<description><![CDATA[I got the idea for this from here: http://cssglobe.com/lab/searchfield/. The idea is that by giving users suggestions of what they should be searching for they can be guided to the most important information. When I am searching for something many times I am unsure what what search terms will give me the best results. To get [...]


Related posts:<ol><li><a href='http://davecavins.com/2009/10/suggestions-foto-the-sharepoint-search-box-part-2/' rel='bookmark' title='Adding Suggestions to the Sharepoint search box : Part 2'>Adding Suggestions to the Sharepoint search box : Part 2</a></li>
<li><a href='http://davecavins.com/2011/08/simple-search-box-with-radio-buttons/' rel='bookmark' title='Simple Search Box with Radio Buttons'>Simple Search Box with Radio Buttons</a></li>
<li><a href='http://davecavins.com/2010/03/adding-comments-to-a-list-part-2/' rel='bookmark' title='Adding Comments to a List Part 2'>Adding Comments to a List Part 2</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-70 alignright" title="search" src="http://davecavins.com/wp-content/uploads/2009/04/search.jpg" alt="Search Suggestions" width="243" height="152" /></p>
<p>I got the idea for this from here: <a href="http://cssglobe.com/lab/searchfield/" target="_blank">http://cssglobe.com/lab/searchfield/</a>. The idea is that by giving users suggestions of what they should be searching for they can be guided to the most important information. When I am searching for something many times I am unsure what what search terms will give me the best results.</p>
<p>To get started we will need a search box to work with.  The out of the box search box could work but I prefer to use the one mentioned <a href="http://www.thesug.org/Blogs/kyles/archive/2008/2/11/Design_Minute_SharePoint_Search_Box.aspx.aspx" target="_blank">here by Kyle Schaeffer</a> because it gives me a lot more flexibility with the design.   <span id="more-46"></span></p>
<h3>Adding a Search Box to the page</h3>
<p>To get the search box on your page :</p>
<ol>
<li>Add this register tag at the top of the page layout or masterpage :
<pre class="brush: plain; title: ; notranslate">
&lt;%@ Register Tagprefix=&quot;SPSWC&quot;
Namespace=&quot;Microsoft.SharePoint.Portal.WebControls&quot;
Assembly=&quot;Microsoft.SharePoint.Portal, Version=12.0.0.0,
Culture=neutral, PublicKeyToken=71e9bce111e9429c&quot; %&gt;</pre>
</li>
<li>If needed hide the existing search box (I left mine, and it still works fine).</li>
<li>Put this code where you want the search box to show up:
<pre class="brush: plain; title: ; notranslate">&lt;br /&gt;
&lt;div id=&quot;searchLayout&quot;&gt;
&lt;SPSWC:SearchBoxEx id=&quot;SearchBox&quot; RegisterStyles=&quot;false&quot; TextBeforeTextBox=&quot;&quot; TextBoxWidth=&quot;200&quot; GoImageUrl=&quot;&quot; GoImageActiveUrl=&quot;&quot; GoImageUrlRTL=&quot;&quot; GoImageActiveUrlRTL=&quot;&quot; UseSiteDefaults=&quot;true&quot; DropDownMode=&quot;HideScopeDD&quot; SuppressWebPartChrome=&quot;true&quot; runat=&quot;server&quot; WebPart=&quot;true&quot; __WebPartId=&quot;{0043945F-2D2B-4A02-8510-CED13B6F04DF}&quot;&gt;
&lt;/div&gt;
&lt;p&gt; </pre>
</li>
<li>Save the page.</li>
</ol>
<h3>Javascript</h3>
<p>Ok now comes the integration part.  In the JavaScript code searchfield.js you must insert the ID of the search input field.</p>
<p>
<pre class="brush: jscript; title: ; notranslate">var id = &quot;searchfield&quot;</pre>
</p>
<p>In ASP.NET control IDs change when the page is rendered so the best way to do this is to view the source of the page or use FireBug to get the id.  It will be something long like &#8220;ctl00_PlaceHolderMain_searchbox2_SFF4064A0_InputKeywords&#8221;</p>
<p>Now save the JS file and test the page.</p>
<p>If it does not work make sure you have referenced your javascript properly.</p>
<ul>
<li>If you are doing this in a page layout the script link should go inside the AdditionalPageHead content place holder.</li>
<li><span class="asp">If you are putting this in a masterpage you can either refernece the script in the &lt;head&gt; section or just above the closing &lt;/body&gt; tag.</span></li>
</ul>
<div id="attachment_151" class="wp-caption aligncenter" style="width: 229px"><a href="http://davecavins.com/wp-content/uploads/2009/04/search2.jpg"><img class="size-full wp-image-151" title="search2" src="http://davecavins.com/wp-content/uploads/2009/04/search2.jpg" alt="Search Suggestions" width="219" height="200" /></a><p class="wp-caption-text">Search Suggestions</p></div>
<h3>Watch out</h3>
<p>This script includes code that will clear the contents of the search box on the first focus so you don&#8217;t need to use the &#8220;QueryPromptString&#8221; tag on your search box because it wont work.</p>
<p>This is what mine came out looking like with a little CSS code.  Also to get the &#8220;Go&#8221; image to show up I just set the &#8220;GoImageUrl&#8221; attribute.</p>
<h3>Conclusion</h3>
<p>This is a very simple solution and can help enhance the user experience but it is not as integrated with SharePoint as I would like.  Ideally the suggestions would be read in from a list stored somewhere on the site.</p>


<p>Related posts:<ol><li><a href='http://davecavins.com/2009/10/suggestions-foto-the-sharepoint-search-box-part-2/' rel='bookmark' title='Adding Suggestions to the Sharepoint search box : Part 2'>Adding Suggestions to the Sharepoint search box : Part 2</a></li>
<li><a href='http://davecavins.com/2011/08/simple-search-box-with-radio-buttons/' rel='bookmark' title='Simple Search Box with Radio Buttons'>Simple Search Box with Radio Buttons</a></li>
<li><a href='http://davecavins.com/2010/03/adding-comments-to-a-list-part-2/' rel='bookmark' title='Adding Comments to a List Part 2'>Adding Comments to a List Part 2</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://davecavins.com/2009/04/adding-suggestiong-to-the-sharepoint-search-box/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

