<?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; ticker</title>
	<atom:link href="http://davecavins.com/tag/ticker/feed/" rel="self" type="application/rss+xml" />
	<link>http://davecavins.com</link>
	<description>web design, SharePoint customization &#38; random stuff</description>
	<lastBuildDate>Wed, 28 Mar 2012 18:07:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<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/11/zoomable-photo-grid/' rel='bookmark' title='Zoomable Photo Grid'>Zoomable Photo Grid</a></li>
<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>
</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><span id="more-540"></span>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><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/11/zoomable-photo-grid/' rel='bookmark' title='Zoomable Photo Grid'>Zoomable Photo Grid</a></li>
<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>
</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>SharePoint Vertical News Ticker</title>
		<link>http://davecavins.com/2009/11/sharepoint-vertical-news-ticker/</link>
		<comments>http://davecavins.com/2009/11/sharepoint-vertical-news-ticker/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 20:22:46 +0000</pubDate>
		<dc:creator>davecavins</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Endusersharepoint]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[ticker]]></category>
		<category><![CDATA[webparts]]></category>

		<guid isPermaLink="false">http://davecavins.com/?p=341</guid>
		<description><![CDATA[On a recent project I needed to create a simple news ticker do display announcements from a SharePoint list. It was easy to do because I just used some of the code from the announcements slider I built a while back so I did not bother to write a post about it. Yesterday I saw [...]
Related posts:<ol>
<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>
<li><a href='http://davecavins.com/2009/11/slideshow-with-captions/' rel='bookmark' title='Image Slideshow with captions'>Image Slideshow with captions</a></li>
<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>
</ol>]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-349 alignright" title="ticker1" src="http://davecavins.com/wp-content/uploads/2009/11/ticker1.jpg" alt="ticker1" width="197" height="433" />On a recent project I needed to create a simple news ticker do display announcements from a SharePoint list. It was easy to do because I just used some of the code from the <a href="http://davecavins.com/2009/07/annoucement-slider-using-web-services">announcements slider</a> I built a while back so I did not bother to write a post about it. Yesterday I saw <a href="http://www.endusersharepoint.com/2009/11/13/scrolling-news-aggregator-in-sharepoint/" target="_blank">a post on EndUserSharePoint.com</a> about how to setup something similar so I figured I would share my (cheaper) solution.</p>
<p>A few features of the ticker:</p>
<ul>
<li>The ticker pulls its contents from the default SharePoint Announcements list using jQuery.</li>
<li>The title of the announcement links to the display form for the item</li>
<li>Ticker pauses on mouseover</li>
<li>For each Announcement the first 500 characters are shown as an intro.</li>
</ul>
<p>Here is the code it can just be pasted in a content editor web part. The only dependency is jQuery. The code for the ticker came from <a href="http://net.tutsplus.com/tutorials/javascript-ajax/build-a-simple-jquery-news-ticker/" target="_blank">this post on Net Tuts Plus</a>. I removed the comments but you can see the <a href="http://net.tutsplus.com/tutorials/javascript-ajax/build-a-simple-jquery-news-ticker/" target="_blank">commented code and an explanation here</a>.<br />
<span id="more-341"></span></p>
<pre class="brush: plain; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot; src=&quot;http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js&quot;&gt;&lt;/script&gt;
  &lt;script type=&quot;text/javascript&quot; src=&quot;ticker.js&quot;&gt;&lt;/script&gt;
	&lt;script type=&quot;text/javascript&quot;&gt;
       $(document).ready(function() {
        var soapEnv =
            &quot;&lt;soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'&gt; \
                &lt;soapenv:Body&gt; \
                     &lt;GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'&gt; \
                        &lt;listName&gt;Announcements&lt;/listName&gt; \
                         &lt;viewFields&gt; \
                            &lt;ViewFields&gt; \
                               &lt;FieldRef Name='Title' /&gt; \
                               &lt;FieldRef Name='Body' /&gt; \
                               &lt;FieldRef Name='ID' /&gt; \
								&lt;FieldRef Name='FileDirRef' /&gt; \
								&lt;FieldRef Name='Created' /&gt; \
                           &lt;/ViewFields&gt; \
                        &lt;/viewFields&gt; \
                    &lt;/GetListItems&gt; \
                &lt;/soapenv:Body&gt; \
            &lt;/soapenv:Envelope&gt;&quot;;

        $.ajax({
            url: &quot;_vti_bin/lists.asmx&quot;,
            type: &quot;POST&quot;,
            dataType: &quot;xml&quot;,
            data: soapEnv,
            complete: processResult,
            contentType: &quot;text/xml; charset=\&quot;utf-8\&quot;&quot;
        });
    });

    function processResult(xData, status) {
        $(xData.responseXML).find(&quot;z\\:row&quot;).each(function() {
        	var teaser = $(this).attr(&quot;ows_Body&quot;);
        	var teaserText = teaser.slice(0,500);
        	var urlValue = $(this).attr(&quot;ows_FileDirRef&quot;);
			var urlArray;
			var urlName;
			     if (urlValue == undefined)
	    	{
      		urlName = &quot;&quot;;
        	}
        	else {
        		urlArray = urlValue.split(&quot;;#&quot;);
        		urlName= urlArray[1];
        	}     	

            var liHtml = &quot;&lt;dt class='newsItem'&gt;&lt;a href='/&quot; + urlName + &quot;/Dispform.aspx?ID=&quot; + $(this).attr(&quot;ows_ID&quot;) + &quot;'&gt;&quot;
            + $(this).attr(&quot;ows_Title&quot;) + &quot;&lt;/a&gt;&lt;/dt&gt;&lt;dd&gt;&quot; + teaserText + &quot;&lt;/p&gt;&lt;/dd&gt;&quot;;
            $(&quot;#ticker&quot;).append(liHtml);
        });
	$(function() {
		var ticker = $(&quot;#ticker&quot;);
		ticker.children().filter(&quot;dt&quot;).each(function() {
		  var dt = $(this),
		    container = $(&quot;&lt;div&gt;&quot;);
		  dt.next().appendTo(container);
		  dt.prependTo(container);
		  container.appendTo(ticker);
		});
		ticker.css(&quot;overflow&quot;, &quot;hidden&quot;);
		function animator(currentItem) {
		  var distance = currentItem.height();
			duration = (distance + parseInt(currentItem.css(&quot;marginTop&quot;))) / 0.025;
		  currentItem.animate({ marginTop: -distance }, duration, &quot;linear&quot;, function() {
			currentItem.appendTo(currentItem.parent()).css(&quot;marginTop&quot;, 0);
			animator(currentItem.parent().children(&quot;:first&quot;));
		  });
		};
		animator(ticker.children(&quot;:first&quot;));
		ticker.mouseenter(function() {
		  ticker.children().stop();
		});
		ticker.mouseleave(function() {
		  animator(ticker.children(&quot;:first&quot;));
		});
	  });
        }
&lt;/script&gt;
&lt;style type=&quot;text/css&quot;&gt;
#ticker {
  width:180px; height:420px; overflow:auto; border:1px solid #aaaaaa;
}
#ticker dt {
  font:normal 14px Georgia; padding:0 10px 5px 10px;
  background:#e5e5e5 url('/_layouts/images/keyword.gif') no-repeat left 60%; padding-top:10px; padding-left:22px;
  border:1px solid #ffffff; border-bottom:none; border-right:none;
}
#ticker dd {
  margin-left:0; font:normal 11px Verdana; padding:0 10px 10px 10px;
  border-bottom:1px solid #aaaaaa; background-color:#e5e5e5;
  border-left:1px solid #ffffff;
}
#ticker dd.last { border-bottom:1px solid #ffffff;  }
#ticker div { margin-top:0; }
&lt;/style&gt;

&lt;div class=&quot;myclass&quot;&gt;
		&lt;dl id=&quot;ticker&quot;/&gt;
&lt;/div&gt;
</pre>
<p>Related posts:<ol>
<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>
<li><a href='http://davecavins.com/2009/11/slideshow-with-captions/' rel='bookmark' title='Image Slideshow with captions'>Image Slideshow with captions</a></li>
<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>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://davecavins.com/2009/11/sharepoint-vertical-news-ticker/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
	</channel>
</rss>

