<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>mike&#039;s sitecore blog</title>
	<atom:link href="http://sitecore.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://sitecore.wordpress.com</link>
	<description>sitecore from scratch</description>
	<lastBuildDate>Wed, 25 Aug 2010 19:26:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='sitecore.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>mike&#039;s sitecore blog</title>
		<link>http://sitecore.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://sitecore.wordpress.com/osd.xml" title="mike&#039;s sitecore blog" />
	<atom:link rel='hub' href='http://sitecore.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Sitecore forum module &#8211; using TinyMCE instead of FreeTextBox</title>
		<link>http://sitecore.wordpress.com/2009/02/20/sitecore-forum-module-using-tinymce-instead-of-freetextbox/</link>
		<comments>http://sitecore.wordpress.com/2009/02/20/sitecore-forum-module-using-tinymce-instead-of-freetextbox/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 21:19:37 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[sitecore]]></category>
		<category><![CDATA[sitecore forum]]></category>
		<category><![CDATA[wysiwyg]]></category>

		<guid isPermaLink="false">http://sitecore.wordpress.com/?p=41</guid>
		<description><![CDATA[I wanted to replace the default WYSIWYG editor supplied with the Sitecore forum module (FreeTextBox) with TinyMCE, as it has better cross-browser compatibility. Here&#8217;s how I did it&#8230; I downloaded TinyMCE and extracted the files into a subfolder of my Sitecore filesystem at /js/tiny_mce. I also created a separate Javascript include file &#8211; /js/tiny_mce_init.js &#8211; to initialise [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sitecore.wordpress.com&amp;blog=4201926&amp;post=41&amp;subd=sitecore&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I wanted to replace the default WYSIWYG editor supplied with the Sitecore forum module (FreeTextBox) with <a href="http://tinymce.moxiecode.com/" target="_blank">TinyMCE</a>, as it has better cross-browser compatibility.</p>
<p>Here&#8217;s how I did it&#8230;</p>
<p><span id="more-41"></span></p>
<p>I <a href="http://tinymce.moxiecode.com/download.php" target="_blank">downloaded TinyMCE</a> and extracted the files into a subfolder of my Sitecore filesystem at /js/tiny_mce. I also created a separate Javascript include file &#8211; /js/tiny_mce_init.js &#8211; to initialise the TinyMCE editor:</p>
<p><pre class="brush: jscript;">
tinyMCE.init({
	// General options
	mode : &quot;textareas&quot;,
	theme : &quot;advanced&quot;,
	plugins : &quot;safari,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,fullscreen,xhtmlxtras&quot;,

	// Theme options
	theme_advanced_buttons1 : &quot;undo,redo,|,cut,copy,paste,pastetext,pasteword,|,search,replace,|,bold,italic,underline,strikethrough,sub,sup,|,forecolor,backcolor,|,bullist,numlist,|,outdent,indent,blockquote&quot;,
	theme_advanced_buttons2 : &quot;link,unlink,anchor,|,image,media,|,cite,abbr,acronym,attribs,|,insertdate,inserttime,charmap,emotions,iespell,|,removeformat,cleanup,code,|,fullscreen,preview,print,|,help&quot;,
	theme_advanced_buttons3: &quot;&quot;,
	theme_advanced_toolbar_location : &quot;top&quot;,
	theme_advanced_toolbar_align : &quot;left&quot;,
	theme_advanced_statusbar_location : &quot;bottom&quot;,
	theme_advanced_resizing : true,
	theme_advanced_resize_horizontal : false,

	// Example content CSS (should be your site CSS)
	content_css : &quot;/styles/style-editor.css&quot;
});
</pre></p>
<p>I also wanted to use the <a href="http://wiki.moxiecode.com/index.php/TinyMCE:Compressor/ASPX" target="_blank">ASP.NET compressor for TinyMCE</a>, which &#8220;&#8230;gzips all javascript files in TinyMCE to a single streamable file. This makes the overall download size 75% smaller and reduces the number of requests to the web server. The initialization time for TinyMCE will also be reduced dramatically by using this script.&#8221;</p>
<p>I <a href="http://tinymce.moxiecode.com/download.php" target="_blank">downloaded the compressor</a> and placed the tiny_mce_gzip.js and tiny_mce_gzip.aspx files in my /js/tiny_mce folder. I also copied the ICSharpCode.SharpZipLib.dll into the bin folder of my Sitecore web application. (NB if you need the latest version of this dll, you can <a href="http://www.icsharpcode.net/OpenSource/SharpZipLib/Download.aspx" target="_blank">get it here</a>.)</p>
<p>To initialise the compressor, I had to create another Javascript file &#8211; /js/tiny_mce/tiny_mce_gzip_init.js &#8211; which looks like this:</p>
<p><pre class="brush: jscript;">
tinyMCE_GZ.init({
   plugins : &quot;advimage,safari,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,fullscreen,xhtmlxtras&quot;,
   themes : 'advanced',
   languages : 'en',
   disk_cache : true,
   debug : false
});
</pre></p>
<p>Not completely sure if this is necessary, but to be on the safe side, I added the path to the compressor .aspx file to IgnoreUrlPrefixes in the Sitecore Web.config file.</p>
<p>

<setting name="IgnoreUrlPrefixes" value="/sitecore/default.aspx|/trace.axd|/webresource.axd|/sitecore/admin/upgrade/|/layouts/testing|/sitecore modules/forum/web/|/users/avatar.aspx|/rss.aspx|/js/tiny_mce/tiny_mce_gzip.aspx" />

</p>
<p>I then created a class in a separate web application project (with post-build event set to xcopy the dll into the Sitecore application&#8217;s bin folder) which inherits from a TextBox and implements the ITextEditor interface. In this class, we override the OnLoad method to inject the appropriate script include blocks.</p>
<p>
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CommunityServer.Controls;

namespace MT.Flag.LivingLife.Controls
{

    public class MTTinyMCE : System.Web.UI.WebControls.TextBox, ITextEditor
    {
        public MTTinyMCE()
            : base()
        {

        }

        //we can probably remove this
        public void Configure()
        {
            if (this.Height.IsEmpty)
                this.Height = Unit.Pixel(400);

            if (this.Width.IsEmpty)
                this.Width = Unit.Percentage(100);

            if (this.Rows == 0)
                this.Rows = 20;

            if (this.Columns == 0)
                this.Columns = 20;

        }

        protected override void OnLoad(EventArgs e)
        {
            this.TextMode = TextBoxMode.MultiLine;
            base.OnLoad(e);
            Configure();

            // register TinyMCE client script
            if (!this.Page.ClientScript.IsClientScriptIncludeRegistered("tinymce"))
            {
                this.Page.ClientScript.RegisterClientScriptInclude("tinymce", this.Page.Request.ApplicationPath.TrimEnd('/') + "/js/tiny_mce/tiny_mce_gzip.js");
                this.Page.ClientScript.RegisterClientScriptInclude("tinymcegzipinit", this.Page.Request.ApplicationPath.TrimEnd('/') + "/js/tiny_mce/tiny_mce_gzip_init.js");
                this.Page.ClientScript.RegisterClientScriptInclude("tinymceinit", this.Page.Request.ApplicationPath.TrimEnd('/') + "/js/tiny_mce_init.js");
            }
        }

        public bool IsRichTextCapable
        {
            get { return true; }
        }

        bool _isAdmin = false;

        public string StyleName
        {
            get { throw new NotImplementedException(); }
            set { throw new NotImplementedException(); }
        }

        public bool EnableHtmlModeEditing
        {
            get { return _isAdmin; }
            set { _isAdmin = value; }
        }

    }
}
</p>
<p>The default text editor for the Forum module is defined in the /communityserver.config file. I changed the textEditorType attribute of the &lt;Core&gt; node to match the class and assembly of the new class above:</p>
<p>
  <Core defaultLanguage="en-US" filesPath="/" disableEmail="false" disableIndexing="false" 
        disableThreading="false" cacheFactor="5" smtpServerConnectionLimit="-1" 
        enableLatestVersionCheck="true" systemType="Self" backwardsCompatiblePasswords="true" 
        textEditorType="MT.Flag.LivingLife.Controls.MTTinyMCE, LivingLifeMT" 
        requireSSL="false" defaultRoles="Everyone;Registered Users" wwwStatus="Ignore">
</p>
<p>All done, and pretty painless in the end. Thanks to Andrey Kovalenko for pointing me in the right direction.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sitecore.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sitecore.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sitecore.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sitecore.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sitecore.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sitecore.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sitecore.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sitecore.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sitecore.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sitecore.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sitecore.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sitecore.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sitecore.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sitecore.wordpress.com/41/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sitecore.wordpress.com&amp;blog=4201926&amp;post=41&amp;subd=sitecore&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sitecore.wordpress.com/2009/02/20/sitecore-forum-module-using-tinymce-instead-of-freetextbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b986bd8710c4888f8de51722e45e4523?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">Mike</media:title>
		</media:content>
	</item>
		<item>
		<title>Getting n random items</title>
		<link>http://sitecore.wordpress.com/2008/09/07/getting-n-random-items/</link>
		<comments>http://sitecore.wordpress.com/2008/09/07/getting-n-random-items/#comments</comments>
		<pubDate>Sun, 07 Sep 2008 08:26:20 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[sitecore]]></category>
		<category><![CDATA[xsl]]></category>

		<guid isPermaLink="false">http://sitecore.wordpress.com/?p=25</guid>
		<description><![CDATA[The project I&#8217;m working on involves showing various case studies. On my case study index page, I wanted to be able to show a selection of random case studies (say, up to four). I can select all the relevant case studies using: &#60;xsl:variable name=&#8221;featuredall&#8221; select=&#8221;$sc_item//item[@template='case study' and sc:fld('featured',.)!='']&#8221; /&#62; However, selecting a set of random [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sitecore.wordpress.com&amp;blog=4201926&amp;post=25&amp;subd=sitecore&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The project I&#8217;m working on involves showing various case studies. On my case study index page, I wanted to be able to show a selection of random case studies (say, up to four).</p>
<p>I can select all the relevant case studies using:<br />
&lt;xsl:variable name=&#8221;featuredall&#8221; select=&#8221;$sc_item//item[@template='case study' and sc:fld('featured',.)!='']&#8221; /&gt;</p>
<p>However, selecting a set of random items from this set isn&#8217;t as easy as it sounds. Using sc:random won&#8217;t work, because there&#8217;s a chance that the same case study will be used more than once.</p>
<p>After much head-scratching, I wrote an XSL Extension which returns a simple nodeset of random integers. This allows me to iterate through that nodeset, referring to the relevant position in my set of case study items&#8230;</p>
<p><span id="more-25"></span>The XSL Extension:</p>
<p><pre class="brush: csharp;">
using System;
using System.IO;
using System.Xml;
using System.Xml.XPath;
using System.Xml.Xsl;
using System.Collections.Generic;
using System.Text;

namespace Flag08v2.classes
{
public class RandomTest
{

public XPathNodeIterator RandomSequence2(int n)
{

Random randomGen = new Random();

List&lt;int&gt; numbers = new List&lt;int&gt;(n);
for (int x = 1; x&lt;=n; x++)
numbers.Add(x);

List&lt;int&gt; randNumbers = new List&lt;int&gt;(n);
for (int x = 0; x&lt;n; x++)
{
int rn = randomGen.Next(numbers.Count);
int rnVal = numbers[rn];

randNumbers.Add(rnVal);
numbers.RemoveAt(rn);
}

Sitecore.Xml.Packet packet = new Sitecore.Xml.Packet(&quot;values&quot;, new string[0]);
foreach (int i in randNumbers)
packet.AddElement(&quot;value&quot;, i.ToString(), new string[0]);

XPathNavigator navigator = packet.XmlDocument.CreateNavigator();
navigator.MoveToRoot();
navigator.MoveToFirstChild();

return navigator.SelectChildren(XPathNodeType.Element);
}
}
}

</pre></p>
<p>Then, add the reference to the XSL Extension in the &lt;xsl:stylesheet&gt; declaration:</p>
<p><pre class="brush: xml;">

&lt;xsl:stylesheet version=&quot;1.0&quot;
xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;
xmlns:sc=&quot;http://www.sitecore.net/sc&quot;
xmlns:dot=&quot;http://www.sitecore.net/dot&quot;
xmlns:mt=&quot;http://www.flag.co.uk/random&quot;
exclude-result-prefixes=&quot;dot sc&quot;
&gt;

</pre></p>
<p>And to iterate through the case studies (&#8220;maxfeatured&#8221; is the maximum number of case studies to show &#8211; I set this using a field elsewhere):</p>
<p><pre class="brush: xml;">

...

&lt;xsl:variable name=&quot;featuredall&quot; select=&quot;$sc_item//item[@template='case study' and sc:fld('featured',.)!='']&quot; /&gt;
&lt;xsl:for-each select=&quot;mt:RandomSequence2(count($featuredall))&quot;&gt;
&lt;xsl:if test=&quot;position() &lt;= $maxfeatured or $maxfeatured = 0&quot;&gt;
&lt;xsl:variable name=&quot;thisNum&quot; select=&quot;text()&quot; /&gt;
&lt;xsl:variable name=&quot;thisItm&quot; select=&quot;$featuredall[position() = $thisNum]&quot; /&gt;

Item &lt;xsl:value-of select=&quot;text()&quot;/&gt; = &lt;xsl:value-of select=&quot;sc:fld('title',$thisItm)&quot;/&gt;

&lt;/xsl:if&gt;
&lt;/xsl:for-each&gt;

</pre></p>
<p>Hope that makes sense!</p>
<p>Mike</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sitecore.wordpress.com/25/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sitecore.wordpress.com/25/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sitecore.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sitecore.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sitecore.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sitecore.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sitecore.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sitecore.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sitecore.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sitecore.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sitecore.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sitecore.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sitecore.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sitecore.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sitecore.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sitecore.wordpress.com/25/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sitecore.wordpress.com&amp;blog=4201926&amp;post=25&amp;subd=sitecore&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sitecore.wordpress.com/2008/09/07/getting-n-random-items/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b986bd8710c4888f8de51722e45e4523?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">Mike</media:title>
		</media:content>
	</item>
		<item>
		<title>Embedding Flash</title>
		<link>http://sitecore.wordpress.com/2008/07/14/embedding-flash/</link>
		<comments>http://sitecore.wordpress.com/2008/07/14/embedding-flash/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 13:17:49 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[flash]]></category>
		<category><![CDATA[sitecore]]></category>
		<category><![CDATA[media]]></category>
		<category><![CDATA[xsl]]></category>

		<guid isPermaLink="false">http://sitecore.wordpress.com/?p=17</guid>
		<description><![CDATA[On the home page of my site, I want to place an unspecified number of Flash "teasers", each linking to somewhere in the site. I also need to specify an image for each "teaser" to be used as a backup for users without Flash support.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sitecore.wordpress.com&amp;blog=4201926&amp;post=17&amp;subd=sitecore&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>On the home page of my site, I wanted to place an unspecified number of Flash &#8220;teasers&#8221;, each linking to somewhere in the site. I also needed to specify an image for each &#8220;teaser&#8221; to be used as a backup for users without Flash support.</p>
<p>This is how I did it&#8230; <span id="more-17"></span></p>
<p>My template for these &#8220;teasers&#8221; looks like this:</p>
<p><img class="size-full wp-image-18" src="http://sitecore.files.wordpress.com/2008/07/teaser.jpg?w=497" alt="Teaser template"   /></p>
<p>So, I have a Droplink which lets the user select a Flash movie from a specified folder in the Media Library, an Image which is also selected from a specified folder in the Media Library, and a General Link which determines where the teaser should link to.</p>
<p>In my content tree, I have a folder where I store &#8220;Teaser&#8221; objects:</p>
<p><img class="size-full wp-image-20" src="http://sitecore.files.wordpress.com/2008/07/teasers-folder.jpg?w=497" alt="Folder of teasers in the content tree"   /></p>
<p>On my &#8220;Home Page&#8221; template, I use a Multilist which points to this folder, so I can manually select which ones will appear on the home page.</p>
<p><img class="size-full wp-image-19" src="http://sitecore.files.wordpress.com/2008/07/teasers-homepg.jpg?w=497" alt="Selecting which teasers go on the home page"   /></p>
<p> So, that&#8217;s the content structure in place. Now for the presentation stuff.</p>
<p>I decided to use Adobe&#8217;s Flash Player Detection script to do the actual embedding (available from <a href="http://www.adobe.com/products/flashplayer/download/detection_kit/" target="_blank">Adobe&#8217;s web site</a>). Flash movies in Sitecore have a .ashx extension, so I had to modify the script slightly because it hard-codes the extension as .swf in the AC_FL_RunContent() function. Just change the second parameter of the call to AC_GetArgs from &#8220;.swf&#8221; to an empty string &#8220;&#8221;:</p>
<p><pre class="brush: jscript;">
// ...
// ...
function AC_FL_RunContent(){
var ret =
AC_GetArgs
( arguments, &quot;&quot;, &quot;movie&quot;, &quot;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&quot;
, &quot;application/x-shockwave-flash&quot;
);
AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}
// ...
// ...
</pre></p>
<p>I then added a Javascript helper function which calls this function (passing the link path to the Flash movie as a FlashVars parameter), and outputs a linked image for users without appropriate Flash support.</p>
<p><pre class="brush: jscript;">
var flashInstance = 0;
function doTeaser (swfPath, swfWidth, swfHeight, swfMajorVersion, swfMinorVersion, swfRevision, swfBgColor, imgPath, imgWidth, imgHeight, imgAlt, linkPath)
{
    var hasRequestedVersion = DetectFlashVer(swfMajorVersion, swfMinorVersion, swfRevision);
    if (hasRequestedVersion)
    {
        AC_FL_RunContent(
        &quot;src&quot;, swfPath,
        &quot;width&quot;, swfWidth,
        &quot;height&quot;, swfHeight,
        &quot;align&quot;, &quot;middle&quot;,
        &quot;id&quot;, (&quot;teaserFlash&quot;+flashInstance++),
        &quot;quality&quot;, &quot;high&quot;,
        &quot;bgcolor&quot;, swfBgColor,
        &quot;name&quot;, (&quot;teaserFlash&quot;+flashInstance++),
        &quot;allowScriptAccess&quot;,&quot;sameDomain&quot;,
        &quot;type&quot;, &quot;application/x-shockwave-flash&quot;,
        'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
        &quot;pluginspage&quot;, &quot;http://www.adobe.com/go/getflashplayer&quot;,
        'FlashVars', 'linkurl='+linkPath
        );
    }
    else
    {
        var alternateContent = '&lt;a href=&quot;' + linkPath + '&quot;&gt;&lt;img src=&quot;' + imgPath + '&quot; alt=&quot;' + imgAlt + '&quot; width=&quot;' + imgWidth + '&quot; height=&quot;' + imgHeight + '&quot; /&gt;&lt;/a&gt;';
        document.write(alternateContent);
    }
}
</pre></p>
<p>So, now we need a rendering which writes a script tag calling this helper function, and a noscript tag which writes the flat image for users without Javascript. I had to work out how to access specific fields of the Flash and image objects in order to pass the raw values into the Javascript function.</p>
<p>The full rendering code, which iterates through all the selected teasers on the home page, is as follows:</p>
<p><pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;

&lt;!--=============================================================
    File: Home Page Teasers.xslt
    Created by: sitecore\mike
    Created: 02/07/2008 16:48:43
    Copyright notice at bottom of file
==============================================================--&gt;

&lt;xsl:stylesheet version=&quot;1.0&quot;
  xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;
  xmlns:sc=&quot;http://www.sitecore.net/sc&quot;
  xmlns:dot=&quot;http://www.sitecore.net/dot&quot;
  exclude-result-prefixes=&quot;dot sc&quot;&gt;

&lt;!-- output directives --&gt;
&lt;xsl:output method=&quot;html&quot; indent=&quot;no&quot; encoding=&quot;UTF-8&quot; /&gt;

&lt;!-- parameters --&gt;
&lt;xsl:param name=&quot;lang&quot; select=&quot;'en'&quot;/&gt;
&lt;xsl:param name=&quot;id&quot; select=&quot;''&quot;/&gt;
&lt;xsl:param name=&quot;sc_item&quot;/&gt;
&lt;xsl:param name=&quot;sc_currentitem&quot;/&gt;

&lt;!-- variables --&gt;
&lt;xsl:variable name=&quot;home&quot; select=&quot;/*/item[@key='content']/item[@key='home']&quot; /&gt;

&lt;!-- entry point --&gt;
&lt;xsl:template match=&quot;*&quot;&gt;
  &lt;xsl:apply-templates select=&quot;$sc_item&quot; mode=&quot;main&quot;/&gt;
&lt;/xsl:template&gt;

&lt;!--==============================================================--&gt;
&lt;!-- main                                                         --&gt;
&lt;!--==============================================================--&gt;

&lt;xsl:template match=&quot;*&quot; mode=&quot;main&quot;&gt;
    &lt;xsl:variable name=&quot;ids&quot; select=&quot;concat(sc:fld('teasers',.),'|')&quot;/&gt;
    &lt;xsl:if test=&quot;string-length($ids)&gt;1&quot;&gt;
&lt;ul class=&quot;teasers&quot;&gt;
            &lt;xsl:call-template name=&quot;doTeasers&quot;&gt;
                &lt;xsl:with-param name=&quot;ids&quot; select=&quot;$ids&quot;/&gt;
            &lt;/xsl:call-template&gt;&lt;/ul&gt;
&lt;/xsl:if&gt;
&lt;/xsl:template&gt;

&lt;xsl:template name=&quot;doTeasers&quot;&gt;
    &lt;xsl:param name=&quot;ids&quot;/&gt;
    &lt;xsl:if test=&quot;$ids&quot;&gt;
        &lt;xsl:variable name=&quot;itm_id&quot; select=&quot;substring-before($ids, '|')&quot;/&gt;
        &lt;xsl:variable name=&quot;itm_rest&quot; select=&quot;substring-after($ids, '|')&quot;/&gt;
        &lt;xsl:variable name=&quot;is_more&quot; select=&quot;boolean(string-length($itm_rest)&gt;0)&quot;/&gt;

        &lt;xsl:if test=&quot;$itm_id&quot;&gt;
            &lt;xsl:variable name=&quot;itm&quot; select=&quot;sc:item($itm_id,.)&quot;/&gt;
            &lt;xsl:if test=&quot;sc:fld('flash',$itm)=''&quot;&gt;
	&lt;li&gt;
                    &lt;xsl:if test=&quot;not($is_more)&quot;&gt;
                        &lt;xsl:attribute name=&quot;class&quot;&gt;last&lt;/xsl:attribute&gt;
                    &lt;/xsl:if&gt;
                    &lt;sc:link select=&quot;sc:item(sc:fld('link',$itm,'id'),.)&quot;&gt;
                        &lt;sc:image field=&quot;image&quot; select=&quot;$itm&quot; /&gt;
                    &lt;/sc:link&gt;&lt;/li&gt;
&lt;/xsl:if&gt;
            &lt;xsl:if test=&quot;sc:fld('flash',$itm)!=''&quot;&gt;
	&lt;li&gt;
                    &lt;xsl:if test=&quot;not($is_more)&quot;&gt;
                        &lt;xsl:attribute name=&quot;class&quot;&gt;last&lt;/xsl:attribute&gt;
                    &lt;/xsl:if&gt;
                    &lt;script type=&quot;text/javascript&quot;&gt;
                        doTeaser(&quot;&lt;xsl:value-of select=&quot;concat('/',sc:GetMediaUrl(sc:item(sc:fld('flash',$itm),.)))&quot; /&gt;&quot;, &lt;sc:text field=&quot;width&quot; select=&quot;sc:item(sc:fld('flash',$itm),.)&quot; /&gt;, &lt;sc:text field=&quot;height&quot; select=&quot;sc:item(sc:fld('flash',$itm),.)&quot; /&gt;, &lt;sc:text field=&quot;version&quot; select=&quot;sc:item(sc:fld('flash',$itm),.)&quot; /&gt;, 0, 0, &quot;&quot;, &quot;&lt;xsl:value-of select=&quot;concat('/',sc:fld('image',$itm,'src'))&quot; /&gt;&quot;, &lt;sc:text field=&quot;width&quot; select=&quot;sc:item(sc:fld('image',$itm,'mediaid'),.)&quot; /&gt;, &lt;sc:text field=&quot;height&quot; select=&quot;sc:item(sc:fld('image',$itm,'mediaid'),.)&quot; /&gt;, &quot;&lt;sc:text field=&quot;alt&quot; select=&quot;sc:item(sc:fld('image',$itm,'mediaid'),.)&quot; /&gt;&quot;, &quot;&lt;xsl:value-of select=&quot;sc:path(sc:item(sc:fld('link',$itm,'id'),.))&quot; /&gt;&quot;);
                    &lt;/script&gt;
                    &lt;noscript&gt;
                        &lt;sc:link select=&quot;sc:item(sc:fld('link',$itm,'id'),.)&quot;&gt;
                            &lt;sc:image field=&quot;image&quot; select=&quot;$itm&quot; /&gt;
                        &lt;/sc:link&gt;
                    &lt;/noscript&gt;&lt;/li&gt;
&lt;/xsl:if&gt;

            &lt;xsl:if test=&quot;$is_more&quot;&gt;
                &lt;xsl:call-template name=&quot;doTeasers&quot;&gt;
                    &lt;xsl:with-param name=&quot;ids&quot; select=&quot;$itm_rest&quot;/&gt;
                &lt;/xsl:call-template&gt;
            &lt;/xsl:if&gt;

        &lt;/xsl:if&gt;
    &lt;/xsl:if&gt;
&lt;/xsl:template&gt;

&lt;/xsl:stylesheet&gt;
</pre></p>
<p>This outputs the teasers inside an unordered list, which I&#8217;ve styled up using CSS.</p>
<p>Finally, here&#8217;s an example showing how to hook up the &#8220;linkurl&#8221; FlashVars parameter in the Flash movie. On the first frame of the movie, set _global.linkurl like this:</p>
<p><img class="size-full wp-image-21" src="http://sitecore.files.wordpress.com/2008/07/flash-getvar.jpg?w=497" alt="Accessing the FlashVars parameter from within Flash"   /></p>
<p>Then, create a button with a hit area the same size as the teaser, and in its onrelease function, call getURL(linkurl) like this:</p>
<p><img class="size-full wp-image-22" src="http://sitecore.files.wordpress.com/2008/07/flash-onrelease.jpg?w=497" alt="Linking the button to the URL"   /></p>
<p>Hope all that makes sense!</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sitecore.wordpress.com/17/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sitecore.wordpress.com/17/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sitecore.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sitecore.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sitecore.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sitecore.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sitecore.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sitecore.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sitecore.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sitecore.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sitecore.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sitecore.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sitecore.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sitecore.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sitecore.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sitecore.wordpress.com/17/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sitecore.wordpress.com&amp;blog=4201926&amp;post=17&amp;subd=sitecore&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sitecore.wordpress.com/2008/07/14/embedding-flash/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b986bd8710c4888f8de51722e45e4523?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">Mike</media:title>
		</media:content>

		<media:content url="http://sitecore.files.wordpress.com/2008/07/teaser.jpg" medium="image">
			<media:title type="html">Teaser template</media:title>
		</media:content>

		<media:content url="http://sitecore.files.wordpress.com/2008/07/teasers-folder.jpg" medium="image">
			<media:title type="html">Folder of teasers in the content tree</media:title>
		</media:content>

		<media:content url="http://sitecore.files.wordpress.com/2008/07/teasers-homepg.jpg" medium="image">
			<media:title type="html">Selecting which teasers go on the home page</media:title>
		</media:content>

		<media:content url="http://sitecore.files.wordpress.com/2008/07/flash-getvar.jpg" medium="image">
			<media:title type="html">Accessing the FlashVars parameter from within Flash</media:title>
		</media:content>

		<media:content url="http://sitecore.files.wordpress.com/2008/07/flash-onrelease.jpg" medium="image">
			<media:title type="html">Linking the button to the URL</media:title>
		</media:content>
	</item>
		<item>
		<title>The journey begins</title>
		<link>http://sitecore.wordpress.com/2008/07/11/the-journey-begins/</link>
		<comments>http://sitecore.wordpress.com/2008/07/11/the-journey-begins/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 22:02:28 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://sitecore.wordpress.com/?p=6</guid>
		<description><![CDATA[OK, so a bit about me &#8212; I&#8217;m getting my hands dirty with Sitecore for the first time, having taken (and passed) SCD1 and SCD2 a while ago. I&#8217;ve got just a light dusting of ASP.NET, and am pretty much teaching myself as I go. I don&#8217;t work in a big team of developers (there [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sitecore.wordpress.com&amp;blog=4201926&amp;post=6&amp;subd=sitecore&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>OK, so a bit about me &#8212; I&#8217;m getting my hands dirty with Sitecore for the first time, having taken (and passed) SCD1 and SCD2 a while ago. I&#8217;ve got just a light dusting of ASP.NET, and am pretty much teaching myself as I go. I don&#8217;t work in a big team of developers (there are just two of us), so I pretty much rely on SDN, the Sitecore support portal, and various blogs when I&#8217;m trying to work out how to do something.</p>
<p>The flexibility of Sitecore&#8217;s content management framework is a strength, but it also means that there are often many different ways of approaching a given situation, and it can be bewildering. Also, a lot of the documentation and blogs assume a certain level of familiarity with the technology, and exposure to the product.</p>
<p>The idea of this blog is to record my small victories; things I&#8217;ve managed to get to work, and how I did it. Hopefully, it will help me to remember what I did, and it might help some other people who find themselves on a similar Sitecore journey.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sitecore.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sitecore.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sitecore.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sitecore.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sitecore.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sitecore.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sitecore.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sitecore.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sitecore.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sitecore.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sitecore.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sitecore.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sitecore.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sitecore.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sitecore.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sitecore.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sitecore.wordpress.com&amp;blog=4201926&amp;post=6&amp;subd=sitecore&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sitecore.wordpress.com/2008/07/11/the-journey-begins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b986bd8710c4888f8de51722e45e4523?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">Mike</media:title>
		</media:content>
	</item>
	</channel>
</rss>
