<?xml version="1.0"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Click Here Digital - Thoughts into text</title>
		<link>http://www.clickheredigital.co.uk/blog/</link>
		<atom:link href="http://www.clickheredigital.co.uk/blog/" rel="self" type="application/rss+xml" />
		<description></description>

		
		<item>
			<title>rel=&quot;nofollow&quot; on SilverStripe outbound links</title>
			<link>http://www.clickheredigital.co.uk/blog/rel-nofollow-on-silverstripe-outbound-links/</link>
			<description>&lt;p&gt;Some users have touched on this before in the forums, but the hack is pretty messy and outdated. We wanted to share an alternative...&lt;/p&gt;
&lt;p&gt;When adding outbound links via the CMS of SilverStripe, users aren't given an option for adding rel=&quot;nofollow&quot;, which can be a pain. Rather than editing the core CMS Link function, one way to deal with this is to point all outbound links to a PHP redirect file:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;?php&lt;br/&gt;$url = $_GET[&quot;affiliate&quot;];&lt;br/&gt;header(&quot;X-Robots-Tag: noindex, nofollow&quot;, true);&lt;br/&gt;header(&quot;Location: &quot;.$url);&lt;br/&gt;exit;&lt;br/&gt;?&amp;gt;&lt;/pre&gt;
&lt;p&gt;The above will get the link from your URL that you pass to this page, E.G - /redirect.php?affiliate=http://ow.ly/hfdgjk&lt;/p&gt;
&lt;p&gt;It will then prevent search engines from indexing or following.&lt;/p&gt;
&lt;p&gt;Finally it will direct users out to the affiliate link.&lt;/p&gt;
&lt;p&gt;It won't suit all needs, but it came in handy for us!&lt;/p&gt;</description>
			<pubDate>Thu, 19 Apr 2012 16:53:09 +0100</pubDate>
			
			
			<guid>http://www.clickheredigital.co.uk/blog/rel-nofollow-on-silverstripe-outbound-links/</guid>
		</item>
		
		<item>
			<title>Bad Widget Class Name Given - Our Experience with Widgets on any SilverStripe Page</title>
			<link>http://www.clickheredigital.co.uk/blog/bad-widget-class-name-given-our-experience-with-widgets-on-any-silverstripe-page/</link>
			<description>&lt;p&gt;Today we took widgets out of their usual stomping ground of the &quot;blog&quot; and introduced them into the wild of other Page Classes.&lt;/p&gt;
&lt;p&gt;To do this:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;class Page extends SiteTree {&lt;br/&gt; &lt;br/&gt;...&lt;br/&gt;    static $has_one = array(&lt;br/&gt;    &quot;WidgetArea&quot; =&amp;gt; &quot;WidgetArea&quot;,&lt;br/&gt;    );&lt;br/&gt;     &lt;br/&gt;    function getCMSFields() {&lt;br/&gt;    $fields = parent::getCMSFields();&lt;br/&gt;    $fields-&amp;gt;addFieldToTab(&quot;Root.Content.Widgets&quot;, new WidgetAreaEditor(&quot;WidgetArea&quot;));&lt;br/&gt;    return $fields;&lt;br/&gt;    }&lt;br/&gt;....&lt;br/&gt;}&lt;/pre&gt;
&lt;p&gt;And then in your template file just add $WidgetArea where you would like them to appear, and you're done! Easy.&lt;/p&gt;
&lt;p&gt;The problems begin when you start adding widgets. We started with:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;LatestBlogPost&lt;/li&gt;
&lt;li&gt;childrenpages&lt;/li&gt;
&lt;li&gt;HtmlContentWidget - (eventually replaced with &quot;widgets_content&quot;)&lt;/li&gt;
&lt;li&gt;twitter&lt;/li&gt;
&lt;li&gt;youtube-1.0.0&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;At first, all seemed great. Except for HtmlContentWidget. The TinyMCE applet wasn't loading by default (you had to save &amp;amp; refresh the page first) which wasn't ideal. Then we noticed that trying to insert an image would throw up the error: &quot;Error details: DOM.get(this.id) is null&quot; (this has been submitted as a SilverStripe bug but never officially solved)&lt;/p&gt;
&lt;p&gt;After some searching through SilverStripe forums we found this solution: &lt;a href=&quot;http://groups.google.com/group/silverstripe-dev/msg/1a3b1292c4f46117&quot; target=&quot;_blank&quot;&gt;http://groups.google.com/group/silverstripe-dev/msg/1a3b1292c4f46117&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;We removed &quot;&lt;span&gt;&lt;span&gt;HtmlContentWidget&quot;&lt;/span&gt;&lt;/span&gt; &amp;amp; installed the attached files (&quot;widgets_content&quot; &amp;amp; &quot;widgeteditor&quot;) from the above link and suddenly our problems were over. Or so we thought.&lt;/p&gt;
&lt;p&gt;After testing further, we found that when adding other widgets now, occasionally we'd receive &quot;Bad Widget Class Name Given&quot; It seemed to be due to the new &quot;widgeteditor&quot; that we had installled as part of the previous fix. It was changing the way widget IDs were handled and as such the &quot;drag &amp;amp; drop&quot; feature were no longer active and adding more than one widget often caused the &quot;Bad Widget Class Name Given&quot; error. That then resulted in us being able to save the page.&lt;/p&gt;
&lt;p&gt;There are lots of forum posts on SilverStripe.org that discuss this issue, our simple solution was to remove the &quot;widgeteditor&quot; folder from our site, but leave in the new &quot;widgets_content&quot;.&lt;/p&gt;
&lt;p&gt;So far, all tests have passed and our client is happily adding widgets as I type.&lt;/p&gt;
&lt;p&gt;Watch this space...&lt;/p&gt;
&lt;h2&gt;Recap&lt;/h2&gt;
&lt;p&gt;To summarise, we ended up by leaving the core folders &amp;amp; files as they, and just using the following widgets:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.clickheredigital.co.uk/ftp/widgets/widgets_childrenpages.zip&quot; target=&quot;_blank&quot;&gt;www.clickheredigital.co.uk/ftp/widgets/widgets_childrenpages.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.clickheredigital.co.uk/ftp/widgets/widgets_content.zip&quot; target=&quot;_blank&quot;&gt;www.clickheredigital.co.uk/ftp/widgets/widgets_content.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.clickheredigital.co.uk/ftp/widgets/widgets_LatestBlogPost.zip&quot; target=&quot;_blank&quot;&gt;www.clickheredigital.co.uk/ftp/widgets/widgets_LatestBlogPost.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.clickheredigital.co.uk/ftp/widgets_twitter.zip&quot; target=&quot;_blank&quot;&gt;www.clickheredigital.co.uk/ftp/widgets_twitter.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.clickheredigital.co.uk/ftp/widgets_youtube-1.0.0.zip&quot; target=&quot;_blank&quot;&gt;www.clickheredigital.co.uk/ftp/widgets_youtube-1.0.0.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Mostly these are standard as downloaded from SilverStripe.org (however the widgets_content is from &lt;a href=&quot;http://groups.google.com/group/silverstripe-dev/msg/1a3b1292c4f46117&quot; target=&quot;_blank&quot;&gt;http://groups.google.com/group/silverstripe-dev/msg/1a3b1292c4f46117&lt;/a&gt; and we updated widgets_youtube and widgets_childrenpages slightly, as they were quite outdated)&lt;/p&gt;
&lt;h2&gt;Update&lt;/h2&gt;
&lt;p&gt;We've just come across a bug with this still, when dragging and dropping widgets containing the tinyMCE editor, we see: &lt;span&gt;&lt;span&gt;&quot;t.win.document is null&quot; and are unable to save the page.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;However, this problem doesnt seem to apply to Chrome browsers.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;A quick search on the web finds this: &lt;/span&gt;&lt;/span&gt;http://readystate4.com/2009/05/15/tinymce-typeerror-twindocument-is-null-in-firebug-console/#comments&lt;/p&gt;
&lt;p&gt;I can see those lines used within the &quot;widgeteditor&quot; folder that we tried earlier, but of course that threw up the &quot;bad class name&quot; error. If anybody can rework those 2 lines of code into the current CMS/javascript/WidgetAreaEditor.js file, I think we could be sorted...&lt;/p&gt;</description>
			<pubDate>Wed, 18 Jan 2012 09:50:59 +0000</pubDate>
			
			
			<guid>http://www.clickheredigital.co.uk/blog/bad-widget-class-name-given-our-experience-with-widgets-on-any-silverstripe-page/</guid>
		</item>
		
		<item>
			<title>ModelAdmin - Display Search Results by Default</title>
			<link>http://www.clickheredigital.co.uk/blog/modeladmin-display-search-results-by-default/</link>
			<description>&lt;p&gt;We know ModelAdmin is for searching/filtering data, not &quot;listing&quot; it. But sometimes we want to hack stuff. It's what we do.&lt;/p&gt;
&lt;p&gt;Thanks to &lt;a title=&quot;Go to this User's Profile&quot; href=&quot;http://www.silverstripe.org/ForumMemberProfile/show/6120&quot;&gt;Martijn&lt;/a&gt; for this great solution:&lt;/p&gt;
&lt;p&gt;Add this method to your ModelAdmin subclass:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;function getEditForm(){ &lt;br/&gt; return $this-&amp;gt;bindModelController('YourDataObjectClassName')-&amp;gt;ResultsForm(array()); &lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;function init(){ &lt;br/&gt;      parent::init(); &lt;br/&gt;      Requirements::javascript('/myfolder/javascript/MyModelAdmin.js'); &lt;br/&gt;   }&lt;/pre&gt;
&lt;p&gt;MyModelAdmin.js&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;(function($){ &lt;br/&gt;$(document).ready(function() { &lt;br/&gt;                   &lt;br/&gt;   // Hide goBack and goForward buttons on initial load &lt;br/&gt;   if(!this.future || !this.future.length) { &lt;br/&gt;      $('#Form_EditForm_action_goForward, #Form_ResultsForm_action_goForward').hide(); &lt;br/&gt;   } &lt;br/&gt;   if(!this.history || this.history.length &amp;lt;= 1) { &lt;br/&gt;      $('#Form_EditForm_action_goBack, #Form_ResultsForm_action_goBack').hide(); &lt;br/&gt;   }                   &lt;br/&gt;    &lt;br/&gt;   /** &lt;br/&gt;    * This will create a url with data from the corresponding SearchForm of the Default DataObject. &lt;br/&gt;    * Don't use live to ensure this is run first on initial load. &lt;br/&gt;    */ &lt;br/&gt;   $('#right #Form_ResultsForm tbody td a:not(.deletelink,.downloadlink)').click(function(){ &lt;br/&gt;      // Set history on initial load for default managed Model &lt;br/&gt;      if(!this.history || this.history.length &amp;lt; 1) { &lt;br/&gt;         var action = $('#Form_ResultsForm').attr('action').replace('ResultsForm?','SearchForm'); &lt;br/&gt;         var form = $('form[action=&quot;'+action+'&quot;]'); &lt;br/&gt;         if(typeof $(form).attr('action') != 'undefined'){ &lt;br/&gt;            var url = $(form).attr('action') + '?' + $(form).serialize(); &lt;br/&gt;            $('#ModelAdminPanel').fn('addHistory', url); &lt;br/&gt;         } &lt;br/&gt;      } &lt;br/&gt;   }); &lt;br/&gt;       &lt;br/&gt;}) &lt;br/&gt;})(jQuery);&lt;/pre&gt;
&lt;p&gt;Now - when you go to your ModelAdmin page, it will show a default search results without having to click the search button, the JS file also forces the &quot;back&quot;, &quot;save&quot; and &quot;delete&quot; buttons into the page.&lt;/p&gt;
&lt;p&gt;END!&lt;/p&gt;</description>
			<pubDate>Fri, 04 Nov 2011 13:52:16 +0000</pubDate>
			
			
			<guid>http://www.clickheredigital.co.uk/blog/modeladmin-display-search-results-by-default/</guid>
		</item>
		
		<item>
			<title>SilverStripe Uploadify &quot;HTTP Error&quot; - &quot;500 Internal Server Error&quot;</title>
			<link>http://www.clickheredigital.co.uk/blog/silverstripe-uploadify-http-error-500-internal-server-error/</link>
			<description>&lt;p&gt;Occasionally we use a client sourced server for hosting, it's rare so when it does happen we forget everything we learnt from our early days with SilverStripe, we came across one today that has caused quite a stir in the SilverStripe forums and thought we'd share our findings here in the hope it saves others some time.&lt;/p&gt;
&lt;p&gt;The website worked fine, but when we migrated it all over to their shared server, we had upload issues. At first we thought it was an Uploadify bug, but after looking into it we found nothing. We checked FireBug for errors and received nothing but &quot;500&quot;.&lt;/p&gt;
&lt;p&gt;Once we gained access to their server error log we found the following:&lt;/p&gt;
&lt;div&gt;
&lt;pre&gt;[Wed Oct 19 12:03:53 2011] [warn]  [client 94.175.14.xx] mod_fcgid: HTTP request length 132180 (so far)  exceeds MaxRequestLen (131072)&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Realised their server was running in FastCGI mode! &lt;br/&gt;switched that to run as Apache module, switched off safe mode.&lt;/p&gt;
&lt;div&gt;
&lt;p&gt;then had this:&lt;/p&gt;
&lt;pre&gt;[Wed Oct 19 16:18:02 2011] [error] [client 94.175.14.xx] PHP  Warning: fopen(/var/www/vhosts/xxxxxxxxxxxx failed to open stream:  Permission denied in xxxxxxxxx&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;SilverStripe wasn't able to write to the tmp folder (open_basedir), so we just quickly  created a &quot;silverstripe-cache&quot; folder in the site root with 777  permission and all is well.&lt;/p&gt;
&lt;p&gt;Naturally these are steps we always take when working on our own server, but all of our sites have PHP support with Apache module by default so we didn't even think to check!&lt;/p&gt;
&lt;h2&gt;Quick Solution&lt;/h2&gt;
&lt;p&gt;Make sure your site is running with PHP support, safe mode off and as Apache module.&lt;/p&gt;
&lt;p&gt;Check that you have a &quot;silverstripe-cache&quot; folder and that it's permissions are 777.&lt;/p&gt;
&lt;p&gt;Check that your assets folder permissions are set correctly too!&lt;/p&gt;
&lt;p&gt;Upload a phpinfo.php file and check your php.ini settings, some of them may need increasing. Primarily:&lt;/p&gt;
&lt;pre&gt;post_max_size &lt;br/&gt;upload_max_filesize&lt;br/&gt;memory_limit &lt;br/&gt;max_file_uploads&lt;br/&gt;max_input_time&lt;/pre&gt;
&lt;p&gt;If you receive upload errors check your site error logs!&lt;/p&gt;
&lt;p&gt;Hopefully this helps others.&lt;/p&gt;</description>
			<pubDate>Wed, 19 Oct 2011 16:29:06 +0100</pubDate>
			
			
			<guid>http://www.clickheredigital.co.uk/blog/silverstripe-uploadify-http-error-500-internal-server-error/</guid>
		</item>
		
		<item>
			<title>SilverStripe UK Date Format</title>
			<link>http://www.clickheredigital.co.uk/blog/silverstripe-uk-date-format/</link>
			<description>&lt;p&gt;Before I start this blog entry, are you here because your &lt;strong&gt;CMS date field is showing a US style date format&lt;/strong&gt;? Well, the most common reason is that your CMS user has their date format set to US in the Security tab! Go there now and check. Admin &amp;gt; Security &amp;gt; User &amp;gt; Date Format&lt;/p&gt;
&lt;p&gt;Now I've covered that, let's talk SilverStripe date format. I didn't realise it was such a widespread topic of confusion, but after seeing the number of hits to our site with date format search terms I decided it was time to address the issue.&lt;/p&gt;
&lt;p&gt;Firstly, dates, languages and currencies are set in the config.php file with:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;i18n::set_locale('en_GB');&lt;/pre&gt;
&lt;p&gt;As long as your CMS user is set to English UK, and your site locale is set to en_GB you should be fine where date formats are concerned. If you have a field type in the CMS that refuses to follow conventional settings, you can always set it directly. I've used the blog module as an example, in Blog &amp;gt; Code &amp;gt; BlogEntry.php around line 84, you can edit it to include the date format for that specific fied:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$fields-&amp;gt;addFieldToTab(&quot;Root.Content.Main&quot;, $dateField = new DatetimeField(&quot;Date&quot;, _t(&quot;BlogEntry.DT&quot;, &quot;Date&quot;)),&quot;Content&quot;);&lt;br/&gt;$dateField-&amp;gt;getDateField()-&amp;gt;setConfig('showcalendar', true);&lt;br/&gt;&lt;strong&gt;$dateField-&amp;gt;getDateField()-&amp;gt;setConfig('dateformat', 'dd/MM/YYYY');   &lt;/strong&gt; &lt;br/&gt;$dateField-&amp;gt;getTimeField()-&amp;gt;setConfig('showdropdown', true);  &lt;br/&gt;&lt;/pre&gt;
&lt;h2&gt;Using $Date in your templates&lt;/h2&gt;
&lt;p&gt;When working with your SilverStripe template files, you can include the date of a blog entry for example by calling $Date. As long as you saved the data via the CMS as the &quot;Date&quot; or &quot;Datetime&quot; type, SilverStripe will know how to render the value automatically.&lt;/p&gt;
&lt;p&gt;Here's how you can use the data with built in controls:&lt;/p&gt;
&lt;p&gt;$Date: 2011-10-07&lt;br/&gt;$Date.Nice: 07/10/2011&lt;br/&gt;$Date.Long: 7 October 2011&lt;br/&gt;$Date.Format(d/m/y): 07/10/11&lt;br/&gt;Or you can call each part separately: &lt;br/&gt;$Date.DayOfMonth $Date.Month $Date.Year&lt;/p&gt;
&lt;p&gt;For the docs of Date class: &lt;a href=&quot;http://api.silverstripe.org/2.4/sapphire/model/Date.html#methodFormat&quot; target=&quot;_blank&quot;&gt;http://api.silverstripe.org/2.4/sapphire/model/Date.html#methodFormat&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;END!&lt;/p&gt;</description>
			<pubDate>Sun, 09 Oct 2011 14:05:09 +0100</pubDate>
			
			
			<guid>http://www.clickheredigital.co.uk/blog/silverstripe-uk-date-format/</guid>
		</item>
		
		<item>
			<title>Include a SilverStripe blog entry on any other page</title>
			<link>http://www.clickheredigital.co.uk/blog/include-a-silverstripe-blog-entry-on-any-other-page/</link>
			<description>&lt;p&gt;Including your latest blog posts throughout your site is easy, you just need a custom function in your Page.php file.&lt;/p&gt;
&lt;p&gt;Here's an example for you:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;function LatestBlogEntry($num=5) { &lt;br/&gt;    $blogpost = DataObject::get_one(&quot;BlogHolder&quot;); &lt;br/&gt;return ($blogpost) ? DataObject::get(&quot;BlogEntry&quot;, &quot;&quot;, &quot;Date DESC&quot;, &quot;&quot;, $num) : false;&lt;/pre&gt;
&lt;p&gt;Then, in your frontend template just call the function like so:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;% control LatestBlogEntry %&amp;gt; &lt;br/&gt;&amp;lt;ul&amp;gt; &lt;br/&gt;&amp;lt;li&amp;gt;&amp;lt;a href=&quot;$Link&quot; title=&quot;Read more on &amp;amp;quot;{$Title}&amp;amp;quot;&quot;&amp;gt;$Title&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt; &lt;br/&gt;&amp;lt;li&amp;gt;$Date.Nice&amp;lt;/li&amp;gt; &lt;br/&gt;&amp;lt;li&amp;gt;$Content.FirstSentence&amp;lt;/li&amp;gt; &lt;br/&gt;&amp;lt;/ul&amp;gt; &lt;br/&gt;&amp;lt;% end_control %&amp;gt;&lt;/pre&gt;
&lt;h2&gt;Calling other objects on any page&lt;/h2&gt;
&lt;p&gt;You can use similar functions to call other items too, like this:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;span&gt;function&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;RandomPart&lt;/span&gt;&lt;span&gt;(){&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;&lt;span&gt;// This returns 3 objects (last argument) of CarPartsPage (your group of parts)&lt;/span&gt;&lt;br/&gt;&lt;span&gt;// and the object returned is ordered randomly (RAND()) so it'll be random&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;&lt;span&gt;       $randomPart &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;DataObject&lt;/span&gt;&lt;span&gt;::&lt;/span&gt;&lt;span&gt;get&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&quot;CarPartsPage&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;null&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&quot;RAND()&quot;&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;null&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;3&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;&lt;span&gt;       &lt;/span&gt;&lt;span&gt;return&lt;/span&gt;&lt;span&gt; $randomPart&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;br/&gt;&lt;span&gt;   &lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Then:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;span&gt;&amp;lt;%&lt;/span&gt;&lt;span&gt; control randomPart%&amp;gt;&lt;/span&gt;&lt;br/&gt;&lt;span&gt;&amp;lt;div&amp;gt;&lt;/span&gt;&lt;br/&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;&amp;lt;a&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;href&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt;&quot;$Link&quot;&lt;/span&gt;&lt;span&gt;&amp;gt;&lt;/span&gt;&lt;br/&gt;&lt;span&gt;       &lt;/span&gt;&lt;span&gt;&amp;lt;div&amp;gt;&lt;/span&gt;&lt;br/&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;&lt;span&gt;$Title&lt;/span&gt;&lt;span&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;&lt;br/&gt;&lt;span&gt;            $Image&lt;/span&gt;&lt;br/&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;br/&gt;&lt;span&gt;            $Content&lt;/span&gt;&lt;br/&gt;&lt;span&gt;            &lt;/span&gt;&lt;span&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;span&gt;                    &lt;/span&gt;&lt;br/&gt;&lt;span&gt;       &lt;/span&gt;&lt;span&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br/&gt;&lt;span&gt;    &lt;/span&gt;&lt;span&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;br/&gt;&lt;span&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br/&gt;&lt;span&gt;&amp;lt;%&lt;/span&gt;&lt;span&gt; end_control %&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;As ever, any suggestions, criticisms or thank yous are allw elcome in the comments below.&lt;/p&gt;</description>
			<pubDate>Fri, 09 Sep 2011 12:46:15 +0100</pubDate>
			
			
			<guid>http://www.clickheredigital.co.uk/blog/include-a-silverstripe-blog-entry-on-any-other-page/</guid>
		</item>
		
		<item>
			<title>Returning Random Page Children in SilverStripe - DataObject::get</title>
			<link>http://www.clickheredigital.co.uk/blog/returning-random-page-children-in-silverstripe-dataobject-get/</link>
			<description>&lt;p&gt;When working with lots of DataObjects, you should really extend DataObject, rather than using pages. But sometimes it MIGHT be easier to just create a few child pages of a parent, then call them as dataObjects throughout your site.&lt;/p&gt;
&lt;p&gt;Let's say your client sells car parts, (but only has a few!) and you create a page for every car part. The page className is &quot;CarPartsPage&quot; and you have them all listed in your sitetree.&lt;/p&gt;
&lt;p&gt;Again, you really should be using the dataObject manager for catalogues of products, only use pages if it's quicker and easier as you only have a handful of products.&lt;/p&gt;
&lt;p&gt;So, you have your products/parts listed as pages, and you want to call 3 of them randomly on the homepage. Here's how:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;function RandomPart(){&lt;br/&gt;&lt;br/&gt;// This returns 1 object (last argument) of CarPartsPage (your group of parts)&lt;br/&gt;// and the object returned is ordered randomly (RAND()) so it'll be random&lt;br/&gt;&lt;br/&gt;       $randomPart = DataObject::get(&quot;CarPartsPage&quot;, null, &quot;RAND()&quot;, null, 3);&lt;br/&gt;&lt;br/&gt;       return $randomPart;&lt;br/&gt;   }&lt;/pre&gt;
&lt;p&gt;The above code should sit in your HomePage.php file if you will only use it there, or pop it into your Page.php if you think you might re-use this function on other pages too.&lt;/p&gt;
&lt;p&gt;Here's an example of how you might use this function in a template:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;% control randomPart%&amp;gt;&lt;br/&gt;&amp;lt;div&amp;gt;&lt;br/&gt;    &amp;lt;a href=&quot;$Link&quot;&amp;gt;&lt;br/&gt;       &amp;lt;div&amp;gt;&lt;br/&gt;            &amp;lt;h2&amp;gt;$Title&amp;lt;/h2&amp;gt;&lt;br/&gt;            $Image&lt;br/&gt;            &amp;lt;p&amp;gt;&lt;br/&gt;            $Content&lt;br/&gt;            &amp;lt;/p&amp;gt;                    &lt;br/&gt;       &amp;lt;/div&amp;gt;&lt;br/&gt;    &amp;lt;/a&amp;gt;&lt;br/&gt;&amp;lt;/div&amp;gt;&lt;br/&gt;&amp;lt;% end_control %&amp;gt;&lt;/pre&gt;
&lt;p&gt;The above first calls the randomPart function loop, then pulls through the Link to the page, the Title of the page, the Image (if you have one) and the content. As this is a control loop and we limited the 'get' to 3 random results, this will repeat 3 times with random pages that have the class CarPartsPage.&lt;/p&gt;
&lt;p&gt;As ever, any suggestions, criticisms or thank yous are allw elcome in the comments below.&lt;/p&gt;</description>
			<pubDate>Thu, 08 Sep 2011 15:04:54 +0100</pubDate>
			
			
			<guid>http://www.clickheredigital.co.uk/blog/returning-random-page-children-in-silverstripe-dataobject-get/</guid>
		</item>
		
		<item>
			<title>Double IF conditions, &lt;% if PageClass = foo OR bar %&gt;</title>
			<link>http://www.clickheredigital.co.uk/blog/double-if-conditions-if-pageclass-foo-or-bar/</link>
			<description>&lt;p&gt;SilverStripe's page templates are quite limiting in terms of the amount of logic they can include. As such, you often find yourself having to create workarounds for what would usually be a simple if statement in PHP.&lt;/p&gt;
&lt;p&gt;One that we regularly come across, is the use of:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;% if InSection(page-url) %&amp;gt;&lt;/pre&gt;
&lt;p&gt;The above condition is pretty useful when you want to include something in just one page using the main Page.ss template. However, if the client ever changes the URL of that page, your if statement is now obsolete.&lt;/p&gt;
&lt;p&gt;A better solution, is to work with the ClassName. For example:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;% if ClassName = HomePage %&amp;gt; do something &amp;lt;% end_if %&amp;gt;&lt;/pre&gt;
&lt;p&gt;Now this is almost unbreakable, unless of course the client changes the page type, in which case they should expect certain things to stop working anyway!&lt;/p&gt;
&lt;p&gt;But what about if you have a blog, and you want to include something in the main outer template, such as a different logo in the header (and not just some content in the BlogEntry.ss layout template). You could use the ClassName IF statement, but that only covers one of the blog page types and you'll probably want to add your rule to the blog holder AND the blog entries.&lt;/p&gt;
&lt;p&gt;SilverStripe's templates won't allow for multiple IF statements, so you'll need a quick custom function. Place the following in your Page.php file (so that you can call it from any page type that extends Page)&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;public function IsBlogSection() {&lt;br/&gt;        switch($this-&amp;gt;ClassName) {&lt;br/&gt;            case 'BlogHolder':&lt;br/&gt;            case 'BlogEntry':&lt;br/&gt;            return true;&lt;br/&gt;            break;&lt;br/&gt;            default:&lt;br/&gt;            return false;&lt;br/&gt;            }&lt;br/&gt;        }&lt;/pre&gt;
&lt;p&gt;The 'case' can have multiple page classes, so that your function can apply to lots of different pages without code repetition. Just call this function in your template like so:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;% if IsBlogSection %&amp;gt; do something &amp;lt;$ end_if %&amp;gt;&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;And there you have it! Every time a user hits a blog holder page, or a blog entry page, the above code will return TRUE, and it doesn't rely on Page URLs remaining intact either.&lt;/p&gt;</description>
			<pubDate>Tue, 06 Sep 2011 13:19:33 +0100</pubDate>
			
			
			<guid>http://www.clickheredigital.co.uk/blog/double-if-conditions-if-pageclass-foo-or-bar/</guid>
		</item>
		
		<item>
			<title>Attaching Multiple Images in SilverStripe</title>
			<link>http://www.clickheredigital.co.uk/blog/attaching-multiple-images-in-silverstripe/</link>
			<description>&lt;p&gt;Out of the box, SilverStripe allows you to insert images into the content of a page, but often we want to make it easier for our end users to add an image in the right place (without breaking everything).&lt;/p&gt;
&lt;p&gt;This is easy,&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;?php&lt;br/&gt;class Page extends SiteTree {&lt;br/&gt; &lt;br/&gt;    static $has_one = array (&lt;br/&gt;    'SingleImage' =&amp;gt; 'Image',&lt;br/&gt;    );&lt;br/&gt;&lt;br/&gt;public function getCMSFields() {&lt;br/&gt;        $fields = parent::getCMSFields();&lt;br/&gt;        $fields-&amp;gt;addFieldToTab(&quot;Root.Content.Image&quot;, new ImageField('SingleImage','Main Image'));&lt;br/&gt;        return $fields;&lt;br/&gt;    }&lt;/pre&gt;
&lt;p&gt;Then, to use the image in your page template:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;% if SingleImage %&amp;gt;&lt;br/&gt;&amp;lt;% control SingleImage %&amp;gt;&lt;br/&gt;            &lt;br/&gt;           &amp;lt;img src='$URL' /&amp;gt;&lt;br/&gt;       &lt;br/&gt;           &amp;lt;% end_control %&amp;gt;         &lt;br/&gt;&amp;lt;% end_if %&amp;gt;&lt;/pre&gt;
&lt;p&gt;But obviously, you may want to have multiple images, perhaps to create a slideshow, or an image gallery. To do this, insert the following into your Page.php class:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;class Page extends SiteTree {&lt;br/&gt;&lt;br/&gt;    public static $has_many = array(    &lt;br/&gt;        'AttachedFiles' =&amp;gt; 'Slideshow'&lt;br/&gt;    );&lt;br/&gt;    &lt;br/&gt;    public function getCMSFields() {&lt;br/&gt;        $fields = parent::getCMSFields();&lt;br/&gt;        $fields-&amp;gt;addFieldToTab(&quot;Root.Content.Slideshow&quot;, new MultipleFileUploadField('AttachedFiles','Slideshow Images'));&lt;br/&gt;        return $fields;&lt;br/&gt;    }&lt;br/&gt;}&lt;/pre&gt;
&lt;p&gt;You'll now need to create a file called Slideshow.php which will extend File or Image:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;?php&lt;br/&gt;class Slideshow extends File {&lt;br/&gt; &lt;br/&gt;    static $has_one = array (&lt;br/&gt;        'Page' =&amp;gt; 'Page'&lt;br/&gt;    ); &lt;br/&gt;}&lt;/pre&gt;
&lt;p&gt;This sets the relation, so that a page can have multiple files, but the files only have one page.&lt;/p&gt;
&lt;p&gt;To return the files/images in your template:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;% control AttachedFiles %&amp;gt;&lt;br/&gt;     &amp;lt;img src='$URL'  height=&quot;480px&quot; alt='$Title'  /&amp;gt;&lt;br/&gt;&amp;lt;% end_control %&amp;gt;&lt;/pre&gt;
&lt;h2&gt;Requirements&lt;/h2&gt;
&lt;p&gt;To use this method, you will need to install &quot;&lt;a href=&quot;http://www.silverstripe.org/uploadify-module/&quot; target=&quot;_blank&quot;&gt;Uploadify&lt;/a&gt;&quot; and &quot;&lt;a href=&quot;http://www.silverstripe.org/dataobjectmanager-module/&quot; target=&quot;_blank&quot;&gt;DataObjectManager&lt;/a&gt;&quot;&lt;/p&gt;</description>
			<pubDate>Wed, 31 Aug 2011 14:21:38 +0100</pubDate>
			
			
			<guid>http://www.clickheredigital.co.uk/blog/attaching-multiple-images-in-silverstripe/</guid>
		</item>
		
		<item>
			<title>&lt;% control Objects %&gt;&lt;% if Pos = 1%&gt; - How to return a specifc item / just 1 from within AttachedImages, AttachedFiles etc.</title>
			<link>http://www.clickheredigital.co.uk/blog/control-objects-if-pos-1-how-to-return-a-specifc-item-just-1-from-within-attachedimages-attachedfiles-etc/</link>
			<description>&lt;p&gt;Let's say you have a listing style site, you allow members to create an item, then &lt;a title=&quot;Tutorial: how to attach multiple images&quot; href=&quot;http://www.clickheredigital.co.uk/blog/attaching-multiple-images-in-silverstripe/&quot;&gt;attach multiple images&lt;/a&gt; to that item. Great.&lt;/p&gt;
&lt;p&gt;But what about if you want to create a list of items, but only display one image in the results? You don't want to have to create a separate upload form so that users can add a &quot;hero image&quot; that will be displayed in search results and as the item thumbnail etc. But you've already realised that using the following control loop will automatically list all of the images:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;% control AttachedImages %&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;img height=&quot;50px&quot; width=&quot;50px&quot; src='$URL'  alt='$Title'  /&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;% end_control %&amp;gt;&lt;/pre&gt;
&lt;p&gt;Well, before you waste time creating a function in your class/controller, try this:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;% control AttachedImages %&amp;gt;&lt;br/&gt;&amp;lt;% if Pos = 1 %&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;img height=&quot;143px&quot; width=&quot;190px&quot; src='$URL'  alt='$Title'  /&amp;gt;&lt;br/&gt;&lt;br/&gt;&amp;lt;% end_if %&amp;gt;&lt;br/&gt;&amp;lt;% end_control %&amp;gt;&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;Now, your loop will only return the first item, which has a position of 1. You could call the second item instead with Pos = 2.&lt;/p&gt;
&lt;p&gt;a full list of available built in page controls is available here: &lt;a title=&quot;SilverStripe built in page controls&quot; href=&quot;http://doc.silverstripe.org/sapphire/en/reference/built-in-page-controls&quot; target=&quot;_blank&quot;&gt;SilverStripe built in page controls&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you decided to ignore the option of allowing users to upload a custom hero image / listing thumbnail, you might still want them to have control over which of the images they uploaded appears.&lt;/p&gt;
&lt;p&gt;One easy way to tackle this, is to sort the AttachedImages by DESC is your _config.php file:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;SortableDataObject::set_sort_dir(&quot;DESC&quot;);&lt;br/&gt;SortableDataObject::add_sortable_class(&quot;Images&quot;);&lt;/pre&gt;
&lt;p&gt;Now, the &lt;strong&gt;last&lt;/strong&gt; image that a user uploads will be the one used in search results etc. You can just add a notice on the multiple upload form that informs users to upload their favourite/default/hero image last.&lt;/p&gt;
&lt;p&gt;As ever, if you see any problems with the above or can improve it, comments welcome below!&lt;/p&gt;</description>
			<pubDate>Wed, 31 Aug 2011 12:41:13 +0100</pubDate>
			
			
			<guid>http://www.clickheredigital.co.uk/blog/control-objects-if-pos-1-how-to-return-a-specifc-item-just-1-from-within-attachedimages-attachedfiles-etc/</guid>
		</item>
		
		<item>
			<title>Another way to embed YouTube videos with SilverStripe</title>
			<link>http://www.clickheredigital.co.uk/blog/another-way-to-embed-youtube-videos-with-silverstripe/</link>
			<description>&lt;p&gt;In June, we showed you how to use shortcodes in the SilverStripe CMS to embed YouTube videos, you can read it here: &lt;a href=&quot;http://www.clickheredigital.co.uk/blog/embedding-youtube-videos-in-silverstripe-using-the-cms/&quot;&gt;Embedding YouTube videos in SilverStripe using the CMS&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;However, we wanted to show you another way to embed YouTube videos, plus have them play in a pop up 'lightbox', with autoplay, and auto generating thumbnails for your videos. It's all relatively simple, and only really involves the template files, so you don't need to create controllers and functions.&lt;/p&gt;
&lt;p&gt;Firstly, create a new page type, e.g - Videos.php and place it in your mysite/code folder. here's an example of that file:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;?php&lt;br/&gt;class Videos extends Page {&lt;br/&gt;&lt;br/&gt;    public static $db = array(&lt;br/&gt;    'Video1URL' =&amp;gt; 'Text',  &lt;br/&gt;    'Video2URL' =&amp;gt; 'Text', &lt;br/&gt;    'Video3URL' =&amp;gt; 'Text', &lt;br/&gt;     );&lt;br/&gt;&lt;br/&gt;    public static $has_one = array(&lt;br/&gt;    );&lt;br/&gt;&lt;br/&gt;    &lt;br/&gt;function getCMSFields() {&lt;br/&gt;$fields = parent::getCMSFields();&lt;br/&gt;$fields-&amp;gt;addFieldToTab(&quot;Root.Content.Videos&quot;, new TextField('Video1URL', 'Video 1 Youtube ID (E.G - tdKMEfvkrFw)'));&lt;br/&gt;$fields-&amp;gt;addFieldToTab(&quot;Root.Content.Videos&quot;, new TextField('Video2URL', 'Video 2 Youtube ID (E.G - tdKMEfvkrFw)'));&lt;br/&gt;$fields-&amp;gt;addFieldToTab(&quot;Root.Content.Videos&quot;, new TextField('Video3URL', 'Video 3 Youtube ID (E.G - tdKMEfvkrFw)'));&lt;br/&gt;return $fields;&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;}&lt;br/&gt;class PackagesPage_Controller extends Page_Controller {    &lt;br/&gt;    public static $allowed_actions = array (&lt;br/&gt;    );&lt;br/&gt;}&lt;/pre&gt;
&lt;p&gt;You can see all we have done is created 3 new fields in our CMS, this is where you will insert your YouTube video IDs. Next we create our template page, Videos.ss to go into our theme directory:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;div&amp;gt; &lt;br/&gt;&amp;lt;a href=&quot;http://www.youtube.com/v/$Video1URL?autoplay=1&quot; rel=&quot;vidbox 800 600&quot; title=&quot;&quot;&amp;gt;&lt;br/&gt;&amp;lt;img width=&quot;240px&quot; alt=&quot;&quot; src=&quot;http://img.youtube.com/vi/$Video1URL/0.jpg&quot;&amp;gt;&lt;br/&gt;&amp;lt;/a&amp;gt;&lt;br/&gt;&amp;lt;/div&amp;gt;&lt;br/&gt;&lt;br/&gt;    &lt;br/&gt;&amp;lt;div&amp;gt; &lt;br/&gt;&amp;lt;a href=&quot;http://www.youtube.com/v/$Video2URL?autoplay=1&quot; rel=&quot;vidbox 800 600&quot; title=&quot;&quot;&amp;gt;&lt;br/&gt;&amp;lt;img width=&quot;240px&quot; alt=&quot;&quot; src=&quot;http://img.youtube.com/vi/$Video2URL/0.jpg&quot;&amp;gt;&lt;br/&gt;&amp;lt;/a&amp;gt;&lt;br/&gt;&amp;lt;/div&amp;gt;&lt;br/&gt;&lt;br/&gt;    &lt;br/&gt;&amp;lt;div&amp;gt; &lt;br/&gt;&amp;lt;a href=&quot;http://www.youtube.com/v/$Video3URL?autoplay=1&quot; rel=&quot;vidbox 800 600&quot; title=&quot;&quot;&amp;gt;&lt;br/&gt;&amp;lt;img width=&quot;240px&quot; alt=&quot;&quot; src=&quot;http://img.youtube.com/vi/$Video3URL/0.jpg&quot;&amp;gt;&lt;br/&gt;&amp;lt;/a&amp;gt;&lt;br/&gt;&amp;lt;/div&amp;gt;&lt;/pre&gt;
&lt;p&gt;These are our 3 video DIVs that will appear with the thumbnails that YouTube automatically creates. We've used 0.jpg as this gives us a nice big thumbnail, rather than the other much smaller ones.&lt;br/&gt;We are pulling the video ID through from our database by using $Video1URL which is the name we assigned to our video fields in the first step. The ?autoplay=1 on the end of the URL ensures that when the video pop up loads, the video starts automatically.&lt;/p&gt;
&lt;p&gt;Next we need to setup our lightbox, if you want the videos to be viewed in this way, you can also just embed them, in which case you won't need to include the thumbnail images of course:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;iframe width=&quot;240&quot; height=&quot;170&quot; src=&quot;http://www.youtube.com/embed/$Video1URL?rel=0&quot; frameborder=&quot;0&quot; allowfullscreen&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/pre&gt;
&lt;p&gt;There's a great 'lightbox for video' tutorial available here:&lt;a href=&quot;http://videobox-lb.sourceforge.net/&quot; target=&quot;_blank&quot;&gt; http://videobox-lb.sourceforge.net/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;END!&lt;/p&gt;
&lt;p&gt;As ever, if you see any problems with the above or can improve it, comments welcome below!&lt;/p&gt;</description>
			<pubDate>Mon, 01 Aug 2011 15:31:12 +0100</pubDate>
			
			
			<guid>http://www.clickheredigital.co.uk/blog/another-way-to-embed-youtube-videos-with-silverstripe/</guid>
		</item>
		
		<item>
			<title>[User Error] Couldn&#39;t run query: SHOW FULL FIELDS IN &quot;Member&quot; Table &#39;SS_mysite.Member&#39; doesn&#39;t exist </title>
			<link>http://www.clickheredigital.co.uk/blog/user-error-couldn-t-run-query-show-full-fields-in-member-table-ss-mysite-member-doesn-t-exist/</link>
			<description>&lt;p&gt;If you come across this error message when trying to migrate a site to a live server, it can be VERY frustrating.&lt;/p&gt;
&lt;p&gt;So you've uploaded your entire site from your local machine or dev server into your live hosting area, now you upload your database and run into this error:&lt;/p&gt;
&lt;p&gt;[User Error] Couldn't run query: SHOW FULL FIELDS IN &quot;Member&quot; Table 'SS_mysite.Member' doesn't exist&lt;/p&gt;
&lt;p&gt;All you actually have to do is logout, but that's impossible at this stage, so you need to drop the database, then run /dev/build, so it rebuilds it like a clean install, now open up admin and LOG OUT.&lt;/p&gt;
&lt;p&gt;Now you've logged out, drop the database again, import your new one and run dev/build again. It should work fine now.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;</description>
			<pubDate>Tue, 21 Jun 2011 18:27:10 +0100</pubDate>
			
			
			<guid>http://www.clickheredigital.co.uk/blog/user-error-couldn-t-run-query-show-full-fields-in-member-table-ss-mysite-member-doesn-t-exist/</guid>
		</item>
		
		<item>
			<title>SilverStripe JQuery conflictions</title>
			<link>http://www.clickheredigital.co.uk/blog/silverstripe-jquery-conflictions/</link>
			<description>&lt;p&gt;SilverStripe uses a lot of JS for things like form validation, especially when using &quot;UserForms&quot; a.k.a &quot;UserDefinedForms&quot;.&lt;/p&gt;
&lt;p&gt;If you have a user form, with a calendar date picker,  twitter feed integration, and a JQuery slideshow, chances are you're going to run into conflicts because of the use of $ vs. JQuery.&lt;/p&gt;
&lt;p&gt;There really isn't a quick fix for this (although I'm not exactly a JS guru to be fair) but a quick Google search will find you many different solutions that will suit different needs.&lt;/p&gt;
&lt;p&gt;A problem we came into today, was that our JQuery Cycle slideshow refused to work on a page that contained a user form with a calendar date picker, so we tried this:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br/&gt;&amp;lt;script type=&quot;text/javascript&quot; src=&quot;http://cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.2.74.js&quot;&amp;gt;&amp;lt;/script&amp;gt;  &lt;br/&gt;      &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;br/&gt;      jQuery.noConflict();  &lt;br/&gt;$(document).ready(function() {&lt;br/&gt;    $('#SlideShow').cycle({&lt;br/&gt;        fx: 'scrollLeft' // choose your transition type, ex: fade, scrollUp, shuffle, etc...&lt;br/&gt;    });&lt;br/&gt;});&lt;br/&gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;
&lt;p&gt;Great! Our slideshow is back up and running, but now our twitter feed has died, and the calendar date picker won't load anymore.&lt;/p&gt;
&lt;p&gt;Next we tried changing the order to this:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;!--TWITTER SCRIPT--&amp;gt;&lt;br/&gt;&amp;lt;script type=&quot;text/javascript&quot; src=&quot;http://twitter.com/javascripts/blogger.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br/&gt;&amp;lt;script type=&quot;text/javascript&quot; src=&quot;http://twitter.com/statuses/user_timeline/USERNAMEHERE.json?callback=twitterCallback2&amp;amp;count=1&quot;&amp;gt;&amp;lt;/script&amp;gt;    &lt;br/&gt;&amp;lt;!--END TWITTER SCRIPT--&amp;gt;&lt;br/&gt;&amp;lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br/&gt;&amp;lt;script type=&quot;text/javascript&quot; src=&quot;http://cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.2.74.js&quot;&amp;gt;&amp;lt;/script&amp;gt;  &lt;br/&gt;      &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;br/&gt;      jQuery.noConflict();  &lt;br/&gt;$(document).ready(function() {&lt;br/&gt;    $('#SlideShow').cycle({&lt;br/&gt;        fx: 'scrollLeft' // choose your transition type, ex: fade, scrollUp, shuffle, etc...&lt;br/&gt;    });&lt;br/&gt;});&lt;br/&gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;
&lt;p&gt;This fixed the Twitter feed, as it's loading the libraries in a better order, but the calendar was persistent. It may be easier to just use a different slieshow script, but I don't like accepting defeat...&lt;/p&gt;
&lt;p&gt;Finally, I updated the $ signs in the userforms code file to JQuery to stop any conflict. Which done the trick!&lt;/p&gt;
&lt;p&gt;In userforms/code/editor/EditableDateField.php, we changed this:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;Requirements::customScript(&amp;lt;&amp;lt;&amp;lt;JS&lt;br/&gt;            (function(jQuery) {&lt;br/&gt;                $(document).ready(function() {&lt;br/&gt;                    $('input[name^=EditableDateField]').attr('autocomplete', 'off').datepicker({ dateFormat: '$dateFormat' });&lt;br/&gt;                });&lt;br/&gt;            })(jQuery);&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;to this:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;Requirements::customScript(&amp;lt;&amp;lt;&amp;lt;JS&lt;br/&gt;            (function(jQuery) {&lt;br/&gt;                jQuery(document).ready(function() {&lt;br/&gt;                    jQuery('input[name^=EditableDateField]').attr('autocomplete', 'off').datepicker({ dateFormat: '$dateFormat' });&lt;br/&gt;                });&lt;br/&gt;            })(jQuery);&lt;br/&gt;&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;And that's got everything working nicely!&lt;/p&gt;
&lt;p&gt;Now, the above solution is pretty hacky, and you should never change files directly within modules, because now we can't update it! But it works for now...and as long as we remember to update the above if we ever upgrade the module, all will be well.&lt;/p&gt;
&lt;p&gt;If anybody can suggest a better way (there MUST be one?!) than the above, please do leave a comment.&lt;/p&gt;
&lt;h2&gt;**Update**&lt;/h2&gt;
&lt;p&gt;You can also remove or block certain files from being loaded on a specific page, this wouldn;t help for y example because my page needed all of the widgets etc to work too, but let's say you had a contact page, with some JS files being linked via the &lt;span class=&quot;codeBlock&quot;&gt;Requirements::javascript(&quot;URL&quot;)&lt;/span&gt; somewhere, well you could block that on your contact page by adding the below to the controller.&lt;/p&gt;
&lt;p&gt;You can delete previously included requirements with the &lt;span class=&quot;codeBlock&quot;&gt;Requirements::clear(&quot;&amp;lt;file path&quot;&amp;gt;)&lt;/span&gt; syntax. A method call to Requirements::clear() without an argument removes all previously included requirements.&lt;/p&gt;
&lt;p&gt;You can also block specific requirements by calling the &lt;span class=&quot;codeBlock&quot;&gt;Requirements::block(&quot;&amp;lt;file path&amp;gt;&quot;)&lt;/span&gt; method. Any file that has been blocked will not be linked to from that page, even if it is specified as a requirement later on in the execution chain. This is useful for replacing a specific JS library with your own. Blocking the old library will prevent conflicts.&lt;/p&gt;</description>
			<pubDate>Tue, 21 Jun 2011 16:17:45 +0100</pubDate>
			
			
			<guid>http://www.clickheredigital.co.uk/blog/silverstripe-jquery-conflictions/</guid>
		</item>
		
		<item>
			<title>Splitting SilverStripe menus into multi columns with &lt;% if MultipleOf(*) %&gt;</title>
			<link>http://www.clickheredigital.co.uk/blog/splitting-silverstripe-menus-into-multi-columns-with-if-multipleof/</link>
			<description>&lt;p&gt;Footer menus can really improve a sites usability AND it's SEO power. But keeping it dynamic and controlled by the CMS can sometimes seem a little tricky.&lt;/p&gt;
&lt;p&gt;One of the common problems is splitting the menu into columns, to avoid having too many rows. To do this, you can use CSS, a function, or some template page controls. Here's my favourite:&lt;/p&gt;
&lt;p&gt;&amp;lt;% if MultipleOf(10) %&amp;gt; &lt;br/&gt;// do stuff &lt;br/&gt;&amp;lt;% end_if %&amp;gt;&lt;/p&gt;
&lt;p&gt;That, when used inside a control loop, will list the first 10 items, then stop and wait for instruction (in this case we would throw in a &amp;lt;/ul&amp;gt; and then open it again with &amp;lt;ul&amp;gt;, then the loop carries on until it hits 20, as that's another multiple of 10!&lt;/p&gt;
&lt;p&gt;This is really handy for breaking your menu up into a few columns, keeping everythign neat and tidy, but most importanlty still CMS-able!&lt;/p&gt;
&lt;p&gt;END!&lt;/p&gt;
&lt;p&gt;As ever, if you see any problems with the above or can improve it, comments welcome below!&lt;/p&gt;</description>
			<pubDate>Mon, 20 Jun 2011 18:44:42 +0100</pubDate>
			
			
			<guid>http://www.clickheredigital.co.uk/blog/splitting-silverstripe-menus-into-multi-columns-with-if-multipleof/</guid>
		</item>
		
		<item>
			<title>Embedding YouTube videos in SilverStripe using the CMS</title>
			<link>http://www.clickheredigital.co.uk/blog/embedding-youtube-videos-in-silverstripe-using-the-cms/</link>
			<description>&lt;p class=&quot;summary&quot;&gt;Thanks a million to the author of this post: &lt;a href=&quot;http://www.ssbits.com/members/profiles/show/28&quot;&gt;Daniel Hensby&lt;/a&gt;, he originally posted this tutorial over at: &lt;a href=&quot;http://www.ssbits.com/tutorials/2010/2-4-using-short-codes-to-embed-a-youtube-video/&quot; target=&quot;_blank&quot;&gt;http://www.ssbits.com/tutorials/2010/2-4-using-short-codes-to-embed-a-youtube-video/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;SilverStripe 2.4 has introduced shortcodes to the CMS editor. Simply, the CMS user can now add short BBCode style code to the editor area and it can then be replaced using a predefined function. For example [link id=23] could be replaced by the link to Page with an ID of 23. In fact that is exactly how internal links created in the links sidebar work in 2.4, preventing them from breaking when URLs change.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;h2&gt;The aim of this tutorial&lt;/h2&gt;
&lt;p&gt;The aim of this tutorial is to allow the CMS user to enter the short code:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;[YouTube id=3UTu6lV8ppY]&lt;/pre&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;[YouTube id=3UTu6lV8ppY]A video about SilverStripe[/YouTube]&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;we will also allow them to add more custom attributes. We will then use this to embed a YouTube video automatically for the user.&lt;/p&gt;
&lt;h2&gt;Short code structure&lt;/h2&gt;
&lt;p&gt;Shortcodes are made up of three parts, the actual ShortCode (YouTube) its arguments (id) and its content (the text surrounded buy the tags - 'A video about SilverStripe').&lt;/p&gt;
&lt;h2&gt;The Short Code Parser&lt;/h2&gt;
&lt;p&gt;The first thing we need to do is to set-up our parser function that will handle the tag, its arguments and its content.&lt;/p&gt;
&lt;p&gt;In &lt;strong&gt;Page.php&lt;/strong&gt; we need to add our handler:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;class Page extends SiteTree {
...
    public static function YouTubeShortCodeHandler($arguments,$caption= null,$parser = null) {
    }
...
}&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;$arguments&lt;/strong&gt; will be an associative array and &lt;strong&gt;$content&lt;/strong&gt; will be a string.&lt;/p&gt;
&lt;p&gt;We now need to set-up some default values for the YouTube video we are going to embed, such as size, height and quality. We need to also merge the defaults with the passed arguments and then return the embed code using a template that we will create next.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;public static function YouTubeShortCodeHandler($arguments,$caption = null,$parser = null) {
	// first things first, if we dont have a video ID, then we don't need to
	// go any further
	if (empty($arguments['id'])) {
		return;
	}
	
	$customise = array();
	/*** SET DEFAULTS ***/
	$customise['YouTubeID'] = $arguments['id'];
	//play the video on page load
	$customise['autoplay'] = false;
	//set the caption
	$customise['caption'] = $caption ? Convert::raw2xml($caption) : false;
	//set dimensions
	$customise['width'] = 640;
	$customise['height'] = 385;
	
	//overide the defaults with the arguments supplied
	$customise = array_merge($customise,$arguments);
	
	//get our YouTube template
	$template = new SSViewer('YouTube');
	
	//return the customised template
	return $template-&amp;gt;process(new ArrayData($customise));
	
}&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;It is worth noting that the keys of the &lt;strong&gt;$arguments&lt;/strong&gt; array will always be in lowercase.&lt;/p&gt;
&lt;h2&gt;The Template&lt;/h2&gt;
&lt;p&gt;In your themes folder you can now add a template called &lt;strong&gt;YouTube.ss&lt;/strong&gt;; I have it in themes/mytheme/Includes as this means I can also use it hard coded into my other page templates if I need to.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;YouTube.ss&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre class=&quot;prettyprint &quot;&gt;&amp;lt;div class=&quot;YouTube&quot;&amp;gt;
	
	&amp;lt;object  type=&quot;application/x-shockwave-flash&quot; data=&quot;http://www.youtube-nocookie.com/v/$YouTubeID&amp;lt;% if autoplay %&amp;gt;&amp;amp;autoplay=1&amp;lt;% end_if %&amp;gt;&quot; width=&quot;$width&quot; height=&quot;$height&quot;&amp;gt;
		&amp;lt;embed  name=&quot;movie&quot; value=&quot;http://www.youtube-nocookie.com/v/$YouTubeID&amp;lt;% if autoplay %&amp;gt;&amp;amp;autoplay=1&amp;lt;% end_if %&amp;gt;&quot; /&amp;gt;
	&amp;lt;/object&amp;gt;
	
	&amp;lt;p&amp;gt;$VideoCaption&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;	&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;This is XHTML valid YouTube embedding code which uses our custom parameters.&lt;/p&gt;
&lt;h2&gt;Registering the Parser&lt;/h2&gt;
&lt;p&gt;Finally, we need to register the parser in our &lt;strong&gt;_config.php&lt;/strong&gt; file:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;...
//shorcodes
ShortcodeParser::get()-&amp;gt;register('YouTube',array('Page','YouTubeShortCodeHandler'));&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;That is it, we have now created our Short Code handler and when a CMS user wants to embed a video from YouTube, they can with ease.&lt;/p&gt;
&lt;h2&gt;Example usage&lt;/h2&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;[YouTube id=4af1bFh3duo width=300 height=150 related=0]blah[/YouTube]&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;</description>
			<pubDate>Wed, 15 Jun 2011 09:38:00 +0100</pubDate>
			
			
			<guid>http://www.clickheredigital.co.uk/blog/embedding-youtube-videos-in-silverstripe-using-the-cms/</guid>
		</item>
		
		<item>
			<title>&quot;File is not a valid upload&quot; Silverstripe 2.4.5</title>
			<link>http://www.clickheredigital.co.uk/blog/file-is-not-a-valid-upload-silverstripe-2-4-5/</link>
			<description>&lt;p&gt;Receiving this error with a new installation or migration? It may be fixed with this patch:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://open.silverstripe.org/changeset/114471&quot; target=&quot;_blank&quot;&gt;http://open.silverstripe.org/changeset/114471&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;In a hurry?&lt;/h2&gt;
&lt;p&gt;Download the files form here:&lt;/p&gt;
&lt;p&gt;&lt;a title=&quot;file is not a valid upload&quot; href=&quot;http://www.clickheredigital.co.uk/assets/Uploads/file-is-not-a-valid-upload.zip&quot; target=&quot;_blank&quot;&gt;file-is-not-a-valid-upload.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;AssetAdmin.php goes into: CMS/CODE/&lt;/p&gt;
&lt;p&gt;Folder.php goes into SAPPHIRE/FILESYSTEM/&lt;/p&gt;</description>
			<pubDate>Tue, 14 Jun 2011 21:41:35 +0100</pubDate>
			
			
			<guid>http://www.clickheredigital.co.uk/blog/file-is-not-a-valid-upload-silverstripe-2-4-5/</guid>
		</item>
		
		<item>
			<title>Creating a client upload area &amp; extending allowed file types with SilverStripe</title>
			<link>http://www.clickheredigital.co.uk/blog/creating-a-client-upload-area-and-extending-allowed-file-types-with-silverstripe/</link>
			<description>&lt;p&gt;Creating a &quot;private&quot; area in your SilverStripe site allows registered users the ability to have more control within your site, one of these permissions could be allowing them to upload larger files to your site, so that you can access them directly within the CMS as and when you need to.&lt;/p&gt;
&lt;p&gt;Doing this is easy, firstly, install the &quot;User Forms&quot; module which can be found here: &lt;a href=&quot;http://www.silverstripe.org/user-forms-module&quot; target=&quot;_blank&quot;&gt;http://www.silverstripe.org/user-forms-module&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Create a new page in your SilverStripe CMS and call it &quot;Client Area&quot; for example.&lt;/p&gt;
&lt;p&gt;Under the behaviours tab, customise who can access this page (a good method is to create a new security group, called clients, then grant just that group access)&lt;/p&gt;
&lt;p&gt;Next, choose &quot;File Upload Field&quot; from within the User Form page, which can be found in the &quot;form&quot; tab. Setup a thank you message, whether or not to send email notifications and who to. Then you're done!&lt;/p&gt;
&lt;p&gt;Now, only users who are members of the &quot;clients&quot; security group can access this page, then they can upload larger files which will be saved in the assets folder, and linked to from within the CMS.&lt;/p&gt;
&lt;p&gt;To extend which file type are allowed, pop this into your mysite/_config.php file:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;File::$allowed_extensions[] = &quot;psd&quot;;&lt;/pre&gt;
&lt;p&gt;The above will allow photoshop PSD files to be uploaded, add others as you need.&lt;/p&gt;
&lt;p&gt;Lastly, you'll need to update the .htaccess or web.config file (depending on your server type) within the assets folder. There are instructions in there how to add file types. But you MUST do this, otherwise you won't be able to access the files from the assets folder!&lt;/p&gt;
&lt;p&gt;END!&lt;/p&gt;
&lt;p&gt;As ever, if you see any problems with the above or can improve it, comments welcome below!&lt;/p&gt;</description>
			<pubDate>Mon, 13 Jun 2011 18:09:32 +0100</pubDate>
			
			
			<guid>http://www.clickheredigital.co.uk/blog/creating-a-client-upload-area-and-extending-allowed-file-types-with-silverstripe/</guid>
		</item>
		
		<item>
			<title>Including $member, $title data, or a hidden field, in user defined forms with SilverStripe</title>
			<link>http://www.clickheredigital.co.uk/blog/including-member-title-data-or-a-hidden-field-in-user-defined-forms-with-silverstripe/</link>
			<description>&lt;p&gt;The user form module, is excellent, it allows content authors to be able to easily create fully functional forms. However, sometimes we need to extend it slightly, one of the most common requirements, are including member data automatically within the form, or a page title. Here's what you need to do:&lt;/p&gt;
&lt;p&gt;Create a file named to suit your function inside userforms/code/editor: such as &quot;CurrentMemberField.php&quot;&lt;/p&gt;
&lt;p&gt;Inside this file, define your data type and setup the field that will be included in the form:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;?php&lt;br/&gt;class EditableCurrentMemberField extends EditableFormField {&lt;br/&gt;&lt;br/&gt;   static $singular_name = 'Member Name Hidden field';&lt;br/&gt;&lt;br/&gt;   function getFormField() {&lt;br/&gt;       $member = Member::currentUser();&lt;br/&gt;      return new HiddenField($this-&amp;gt;Name, $this-&amp;gt;Title, $member-&amp;gt;Email); &lt;br/&gt;}&lt;br/&gt;    public function getIcon() {&lt;br/&gt;        return 'userforms/images/editableliteralfield.png';&lt;br/&gt;    }&lt;br/&gt;}&lt;/pre&gt;
&lt;p&gt;Save that and build your database, now within your form tab of your CMS, you will see a field type called Current Member Field (or what ever you called it) If you include that in your form now, it will automatically create a hidden field, and insert the member email address (obviously they will need to be logged in for this to work)&lt;/p&gt;
&lt;p&gt;If you wanted to include the page title instead, you'd just use this:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;function getFormField() { &lt;br/&gt;      return new HiddenField($this-&amp;gt;Name, null, $this-&amp;gt;Parent()-&amp;gt;Title); &lt;br/&gt;   }&lt;/pre&gt;
&lt;p&gt;If you want to include an object via page relationship, you'll need some conditional formatting too, otherwise when the form submit it will return: &quot;DataObjectManager [Notice] Trying to get property of non-object&quot;&lt;/p&gt;
&lt;pre&gt;function getFormField() {&lt;br/&gt;       if($this-&amp;gt;CurrentPage()-&amp;gt;Job){&lt;br/&gt;      return new HiddenField($this-&amp;gt;Name, null, $this-&amp;gt;CurrentPage()-&amp;gt;Job-&amp;gt;Title);&lt;br/&gt;       }&lt;br/&gt;}&lt;/pre&gt;
&lt;p&gt;Also note that we've included an icon for this field type, to stop ugly alt tags appearing in the CMS.&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt; public function getIcon() {&lt;br/&gt;        return 'userforms/images/editableliteralfield.png';&lt;br/&gt;    }&lt;/pre&gt;
&lt;p&gt;END!&lt;/p&gt;
&lt;p&gt;As ever, if you see any problems with the above or can improve it, comments welcome below!&lt;/p&gt;</description>
			<pubDate>Mon, 13 Jun 2011 17:28:58 +0100</pubDate>
			
			
			<guid>http://www.clickheredigital.co.uk/blog/including-member-title-data-or-a-hidden-field-in-user-defined-forms-with-silverstripe/</guid>
		</item>
		
		<item>
			<title>Creating a mobile site with SilverStripe</title>
			<link>http://www.clickheredigital.co.uk/blog/creating-a-mobile-site-with-silverstripe/</link>
			<description>&lt;p&gt;Although most of the latest handheld devices (iPhone, iPad, Blackberry, HTC etc.) display full web sites in all their glory, the majority of older mobiles do not. Websites on mobiles usually render terribly due to the smaller screen and poor load speeds, as such, it's always a good idea to create a version of your site just for handheld devices. Luckily, with SilverStripe this is super simple, and here's how it's done:&lt;/p&gt;
&lt;p&gt;Firstly, download the module from here: &lt;a href=&quot;http://silverstripe.org/mobile/&quot; target=&quot;_blank&quot;&gt;http://silverstripe.org/mobile/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img class=&quot;left&quot; src=&quot;http://www.clickheredigital.co.uk/assets/_resampled/resizedimage191285-mobile-demo-site.png&quot; alt=&quot;Mobile Site&quot; title=&quot;Mobile Site&quot; width=&quot;191&quot; height=&quot;285&quot;/&gt;&lt;/p&gt;
&lt;p&gt;Upload this to your root directory and run: dev/build&lt;/p&gt;
&lt;p&gt;This will automatically set everything up for you, please note that your themes folder probably isn't writable, so you'll need to upload the &quot;theme&quot; folder from within the mobile module directly to your themes folder online. You may also want to rename it to something more user friendly too (E.G - MySite_Mobile)&lt;/p&gt;
&lt;p&gt;Next, open up your CMS and click the site name on the left hand side to view the overall site config. There's a nice new tab called &quot;mobile&quot; click that to manage your mobile version. You can either redirect all mobile users to a sub-domain, or simply load the site with the mobile theme for them, and keep the URL the same.&lt;/p&gt;
&lt;p&gt;We prefer the latter option, so just click &quot;Mobile users see mobile theme, but no redirection occurs&quot; then delete all of the content within the &quot;Mobile domain&quot; field. (otherwise it conflicts with the main site a bit, this bug will probably be ironed out soon)&lt;/p&gt;
&lt;p&gt;Then choose your mobile theme from the drop down box, and save. Now you're all set!&lt;/p&gt;
&lt;p&gt;Customise your mobile theme templates and CSS as you wish, you may also need to add templates to it from your blog theme etc, and then amend them so that things like the sidebar (that aren't really required on mobile) won't be loaded in.&lt;/p&gt;
&lt;h2&gt;Troubleshooting:&lt;/h2&gt;
&lt;ol&gt;&lt;li&gt;Make sure that your main theme is defined within your _config.php file, then choose &quot;use default theme&quot; from within the CMS on the main site, and choose your mobile theme in the mobile tab. (this may be fixed soon too)&lt;/li&gt;
&lt;li&gt;Remember that not all of your pages will work out of the box with the included theme (e.g - your blog, image gallery etc) these will all need to be customised for mobile yourself!&lt;/li&gt;
&lt;li&gt;&quot;Full site&quot; link doesn't work if you're redirecting mobile devices to a mobile domain&lt;/li&gt;
&lt;/ol&gt;&lt;ul&gt;&lt;p&gt;A huge thank you to the &lt;span&gt;Maintainer(s):&lt;/span&gt; &lt;a href=&quot;http://silverstripe.org/ForumMemberProfile/show/16&quot;&gt;Sean&lt;/a&gt;,  			 				&lt;a href=&quot;http://silverstripe.org/ForumMemberProfile/show/94&quot;&gt;Willr&lt;/a&gt; for bringing us this module.&lt;/p&gt;
&lt;p&gt;As ever, if you see any problems with the above or can improve it, comments welcome below!&lt;/p&gt;
&lt;/ul&gt;</description>
			<pubDate>Mon, 13 Jun 2011 15:41:47 +0100</pubDate>
			
			
			<guid>http://www.clickheredigital.co.uk/blog/creating-a-mobile-site-with-silverstripe/</guid>
		</item>
		
		<item>
			<title>How to include a SilverStripe form on any/every page</title>
			<link>http://www.clickheredigital.co.uk/blog/how-to-include-a-silverstripe-form-on-any-every-page/</link>
			<description>&lt;p&gt;Here's a quick tutorial on the best way to include a SilverStripe function (e.g - a signup form) on any page, or every page, or a sidebar, or footer of your SilverStripe site.&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;?php&lt;br/&gt;class RegistrationForm extends Page {&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;class RegistrationForm_Controller extends Page_Controller {&lt;br/&gt;&lt;br/&gt;// Make sure you set this to the right group.&lt;br/&gt;// See http://doc.silverstripe.com/doku.php?do=show&amp;amp;id=recipes%3Aforms&lt;br/&gt;private $defaultGroupID = 3;&lt;br/&gt;&lt;br/&gt;/**&lt;br/&gt;* This function lets you put a form on your page, using $Form.&lt;br/&gt;*/&lt;br/&gt;function SignupForm() {&lt;br/&gt;return new Form($this, &quot;SignupForm&quot;, new FieldSet(&lt;br/&gt;&lt;br/&gt;    // List your fields here&lt;br/&gt;    //new TextField(&quot;FirstName&quot;, &quot;First name&quot;),&lt;br/&gt;    //new TextField(&quot;Surname&quot;),&lt;br/&gt;    new EmailField(&quot;Email&quot;, &quot;&quot;)&lt;br/&gt;&lt;br/&gt;), new FieldSet(&lt;br/&gt;&lt;br/&gt;    // List the action buttons here&lt;br/&gt;    new FormAction(&quot;SignupAction&quot;, &quot;GO&quot;)&lt;br/&gt;&lt;br/&gt;), new RequiredFields(&lt;br/&gt;&lt;br/&gt;    // List the required fields here: &quot;Email&quot;, &quot;FirstName&quot;&lt;br/&gt;&lt;br/&gt;));&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;/**&lt;br/&gt;* This function is called when the user submits the form.&lt;br/&gt;*/&lt;br/&gt;function SignupAction($data, $form) {&lt;br/&gt;&lt;br/&gt;$email = Convert::raw2sql($data['Email']); // prevent sql injection&lt;br/&gt;$existingUser = DataObject::get_one(&quot;Member&quot;, &quot;Email = '$email'&quot;);&lt;br/&gt;if($existingUser) {&lt;br/&gt; // Add a error message&lt;br/&gt; $form-&amp;gt;addErrorMessage(&quot;Message&quot;,&quot;Sorry, that email address already exists. Please choose another.&quot;,&quot;bad&quot;);&lt;br/&gt;&lt;br/&gt; // Load errors into session and post back&lt;br/&gt; Session::set(&quot;FormInfo.RegistrationForm_RegistrationForm.data&quot;, $data);&lt;br/&gt;&lt;br/&gt; // Redirect back to form&lt;br/&gt; Director::redirectBack();&lt;br/&gt; return;&lt;br/&gt;} &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;// Create a new Member object and load the form data into it&lt;br/&gt;$member = new Member();&lt;br/&gt;$form-&amp;gt;saveInto($member);&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;// Write it to the database.  This needs to happen before we add it to a group&lt;br/&gt;$member-&amp;gt;write();&lt;br/&gt;&lt;br/&gt;// Add the member to group. (Check if it exists first)&lt;br/&gt;if($group = DataObject::get_one('Group', &quot;ID = $this-&amp;gt;defaultGroupID&quot;)) { &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;    $member-&amp;gt;Groups()-&amp;gt;add($group);&lt;br/&gt;    // Redirect to a page thanking people for registering&lt;br/&gt;    //Director::redirect('thanks-for-registering/');&lt;br/&gt;    &lt;br/&gt;    // In this example we are going to redirect back to the form, and simply add a thank you message.&lt;br/&gt;$form-&amp;gt;addErrorMessage(&quot;Message&quot;,&quot;Thank you.&quot;,&quot;good&quot;);&lt;br/&gt;  // Redirect back to form&lt;br/&gt; Director::redirectBack();&lt;br/&gt; return;&lt;br/&gt;&lt;br/&gt;}else{&lt;br/&gt;&lt;br/&gt;    // Redirect to a failure page&lt;br/&gt;    Director::redirect('registration-failed/');&lt;br/&gt;&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;}&lt;br/&gt;}&lt;/pre&gt;
&lt;p&gt;Next, add this into your page.php file (this enables you to use the above function on any page)&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;function ShowForm(){&lt;br/&gt;$get = DataObject::get_one('RegistrationForm');&lt;br/&gt;return new RegistrationForm_Controller($get); }&lt;/pre&gt;
&lt;p&gt;Then to call your function in your template (e.g page.ss, footer.ss or sidebar.ss) just paste in this:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;% control ShowForm %&amp;gt;&lt;br/&gt;$SignupForm&lt;br/&gt;&amp;lt;% end_control %&amp;gt;&lt;/pre&gt;
&lt;h2&gt;Includng a userform / userdefinedform on any page&lt;/h2&gt;
&lt;p&gt;If you're making use of userforms, then it's even easier! just add this to your page.php file:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;function ShowForm(){&lt;br/&gt;    $get = DataObject::get_one('UserDefinedForm');&lt;br/&gt;    return new UserDefinedForm_Controller($get); &lt;br/&gt;}&lt;/pre&gt;
&lt;p&gt;then in your template file:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;% control ShowForm %&amp;gt;&lt;br/&gt;$Form&lt;br/&gt;&amp;lt;% end_control %&amp;gt;&lt;/pre&gt;
&lt;p&gt;You can also create a form function within your Page.php for using throughout the site, very handy for newsletter signup forms in footers etc. Just create your form function in Page.php and ensure you list it as an &quot;$allowed_actions&quot;. E.G:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;public static $allowed_actions = array (&lt;br/&gt;            'SignupForm'                                &lt;br/&gt;    );&lt;/pre&gt;
&lt;p&gt;This method will come in handy throughout your time with SilverStripe so keep hold of it!&lt;/p&gt;
&lt;h2&gt;Troubleshooting&lt;/h2&gt;
&lt;p&gt;If you use any form of jquery throughout your site, you may find including the form will break things! The problem is that when you $get the userform and include it's controller you pull through the related JS files which may conflict with other scripts on your page. One way to avoid this is switch off js validation and ajax commenting by placing the following in your config file:&lt;/p&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;Validator::set_javascript_validation_handler('none'); &lt;br/&gt;PageCommentInterface::set_use_ajax_commenting(false);&lt;/pre&gt;
&lt;p&gt;As ever, if you see any problems with the above or can improve it, comments welcome below!&lt;/p&gt;</description>
			<pubDate>Fri, 10 Jun 2011 15:46:56 +0100</pubDate>
			
			
			<guid>http://www.clickheredigital.co.uk/blog/how-to-include-a-silverstripe-form-on-any-every-page/</guid>
		</item>
		

	</channel>
</rss>
