<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Silverstripe on PHP Boy Scout</title><link>https://blog-570662.gitlab.io/tags/silverstripe/</link><description>Recent content in Silverstripe on PHP Boy Scout</description><generator>Hugo -- gohugo.io</generator><language>en-gb</language><copyright>Matt Cockayne</copyright><lastBuildDate>Mon, 12 Jan 2015 00:00:00 +0000</lastBuildDate><atom:link href="https://blog-570662.gitlab.io/tags/silverstripe/index.xml" rel="self" type="application/rss+xml"/><item><title>Free Open Source Website for Scouts</title><link>https://blog-570662.gitlab.io/free-open-source-website-scouts/</link><pubDate>Mon, 12 Jan 2015 00:00:00 +0000</pubDate><guid>https://blog-570662.gitlab.io/free-open-source-website-scouts/</guid><description>&lt;img src="https://blog-570662.gitlab.io/free-open-source-website-scouts/scouts-snapshot.png" alt="Featured image of post Free Open Source Website for Scouts" /&gt;&lt;p&gt;I&amp;rsquo;ve been a Scout Leader for a few years now and the District I work within have very little by way of internet presence. As a bit of a pet project I started building a simple Scout based website for them to use.&lt;/p&gt;
&lt;p&gt;Its nothing too fancy, I created a simple module and theme for the Silverstripe CMS and have now put it into a GitHub Repository to share with the wider scouting community.&lt;/p&gt;
&lt;p&gt;I chose Silverstripe because of the speed with which I could develop something usable as well as providing a super simple management interface that can be handled by users of all skill levels.&lt;/p&gt;
&lt;p&gt;The module itself extends some very common extensions available for the CMS and makes them scout focused. Features include.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Customisable theme&lt;/li&gt;
&lt;li&gt;Multi tiered Event Calendars&lt;/li&gt;
&lt;li&gt;Customisable Group/Section Pages&lt;/li&gt;
&lt;li&gt;Dynamic Forms&lt;/li&gt;
&lt;li&gt;A reliable News/Blog system&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These are just a few of the most obvious features and hopefully I will continue to add more.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m also offering to help any Scout Groups/Districts/Counties if they are wanting to use these modules and get their sites built and up and running for them free of charge.&lt;/p&gt;
&lt;p&gt;If you want to take a look at the code and have a play yourselves you can find it online at&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class="link" href="https://github.com/phpboyscout/silverstripe-scouts" target="_blank" rel="noopener"
 &gt;https://github.com/phpboyscout/silverstripe-scouts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link" href="https://github.com/phpboyscout/silverstripe-scouts-theme" target="_blank" rel="noopener"
 &gt;https://github.com/phpboyscout/silverstripe-scouts-theme&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you want to get in touch or would like more information about having a website built for you please fill in the form below.&lt;/p&gt;
&lt;p&gt;[contact-form &lt;a class="link" href="mailto:to=%27matt@phpboyscout.uk" &gt;to='matt@phpboyscout.uk&lt;/a&gt;&amp;rsquo; subject=&amp;lsquo;Request for Scouts Website&amp;rsquo;][contact-field label=&amp;lsquo;Name&amp;rsquo; type=&amp;lsquo;name&amp;rsquo; required=&amp;lsquo;1&amp;rsquo;/][contact-field label=&amp;lsquo;Email&amp;rsquo; type=&amp;lsquo;email&amp;rsquo; required=&amp;lsquo;1&amp;rsquo;/][contact-field label=&amp;lsquo;Scout Group/District/County&amp;rsquo; type=&amp;lsquo;url&amp;rsquo; required=&amp;lsquo;1&amp;rsquo;/][/contact-form]&lt;/p&gt;</description></item><item><title>Creating Custom Routes in Silverstripe 3.1</title><link>https://blog-570662.gitlab.io/creating-custom-routes-silverstripe/</link><pubDate>Wed, 31 Jul 2013 00:00:00 +0000</pubDate><guid>https://blog-570662.gitlab.io/creating-custom-routes-silverstripe/</guid><description>&lt;p&gt;We wanted to create a Route to our custom Products Controller in our products module for SilverStripe 3.1, such as: &amp;ldquo;&lt;a class="link" href="http://www.examplesite.com/products/" target="_blank" rel="noopener"
 &gt;http://www.examplesite.com/products/&lt;/a&gt;&lt;product-slug&gt;&amp;rdquo;&lt;/p&gt;
&lt;p&gt;However looking at the &lt;a class="link" href="http://doc.silverstripe.org/framework/en/3.1/topics/controller" title="Controller Documentation"
 target="_blank" rel="noopener"
 &gt;Controller Documentation&lt;/a&gt; it was not clear how to create a route without an Action being supplied. In our example above the action is not specified, as we just want to use &amp;lsquo;view&amp;rsquo;.&lt;/p&gt;
&lt;p&gt;Solution:&lt;/p&gt;
&lt;p&gt;Create a &lt;module-name&gt;/_config/routes.yml file containing the following:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;---
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Name: productsroutes
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;After: &amp;#39;framework/routes#coreroutes&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;---
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Director:
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; rules:
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;product&amp;#39;: &amp;#39;Product_Controller&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;---
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The above will redirect any Url that starts with &amp;ldquo;/product&amp;rdquo; to our Product_Controller. Note that everything after the rule, so after &amp;ldquo;/product&amp;rdquo;, is used in the next bit for matching.&lt;/p&gt;
&lt;p&gt;Now we need to add &lt;code&gt;private static $url_handers&lt;/code&gt; to Product_Controller to match our path, so in this example we need to match &amp;ldquo;$Slug!&amp;rdquo; which will match &amp;ldquo;&lt;product-slug&gt;&amp;rdquo;. Note the ! means the slug is required. Of course we want to direct this to a specific action, in this case &amp;ldquo;view&amp;rdquo;, this gives us:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;private static $url_handlers = array(
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &amp;#39;$Slug!&amp;#39; =&amp;gt; &amp;#39;view&amp;#39;,
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now just add &amp;ldquo;view&amp;rdquo; to the $allow_actions and add the &amp;ldquo;view&amp;rdquo; function. This gives the final Product_Controller as follows:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-gdscript3" data-lang="gdscript3"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="n"&gt;Product_Controller&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;Page_Controller&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;private&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;url_handlers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s1"&gt;&amp;#39;$Slug!&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;view&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;private&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;allowed_actions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;view&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;public&lt;/span&gt; &lt;span class="n"&gt;function&lt;/span&gt; &lt;span class="n"&gt;view&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SS_HTTPRequest&lt;/span&gt; &lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="n"&gt;Your&lt;/span&gt; &lt;span class="n"&gt;action&lt;/span&gt; &lt;span class="n"&gt;code&lt;/span&gt; &lt;span class="n"&gt;goes&lt;/span&gt; &lt;span class="n"&gt;here&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;$&lt;/span&gt;&lt;span class="n"&gt;this&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;render&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Handy note:&lt;/p&gt;
&lt;p&gt;You can put ?&lt;code&gt;debug_request=1 on the end of your URL to see how it determines which Controller to use.&lt;/code&gt;&lt;/p&gt;</description></item><item><title>Disabling Cache in Silverstripe 3.1</title><link>https://blog-570662.gitlab.io/disabling-cache-silverstripe/</link><pubDate>Wed, 31 Jul 2013 00:00:00 +0000</pubDate><guid>https://blog-570662.gitlab.io/disabling-cache-silverstripe/</guid><description>&lt;p&gt;While working with Silverstripe we found ourselves having to run &amp;ldquo;?flush=1&amp;rdquo; a lot to clear the Cache. To switch it off, while you work, add the following to your mysite/_config.php:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SS_Cache::set_cache_lifetime(&amp;#39;default&amp;#39;, -1, 100);
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>Set up SilverStripe 3.1 using only Git (No Composer)</title><link>https://blog-570662.gitlab.io/set-up-silverstripe-3-1-using-only-git/</link><pubDate>Mon, 29 Jul 2013 00:00:00 +0000</pubDate><guid>https://blog-570662.gitlab.io/set-up-silverstripe-3-1-using-only-git/</guid><description>&lt;p&gt;We recently tried to use composer to set up SilverStripe 3.1, but ended up with a dependency nightmare. In order to work around this we decided to make use of Git submodules.&lt;/p&gt;
&lt;p&gt;First set up your Git repository and run:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git init
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Next set up a site directory for the code inside your Git repository. Then navigate to &lt;a class="link" href="https://github.com/silverstripe/silverstripe-installer" target="_blank" rel="noopener"
 &gt;SilverStripe Installer&lt;/a&gt; in your browser and Download a copy. Extract files, and copy contents to site folder. Now we need to add the CMS and Framework. Navigate in a browser to the Git Hub repositories for &lt;a class="link" href="https://github.com/silverstripe/silverstripe-cms" target="_blank" rel="noopener"
 &gt;CMS&lt;/a&gt; and &lt;a class="link" href="https://github.com/silverstripe/silverstripe-framework" target="_blank" rel="noopener"
 &gt;Framework.&lt;/a&gt; Now copy the HTTPS clone URL for each project and run the following, to add these as Git sub modules.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git submodule add https://github.com/silverstripe/silverstripe-framework.git site/framework
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git submodule add https://github.com/silverstripe/silverstripe-cms.git &amp;lt;path-to-site&amp;gt;site/cms
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now delete mysite/_config.php and load the site. Follow the normal install instructions displayed and you will have a running version of &lt;a class="link" href="http://www.silverstripe.org/" title="SilverStripe"
 target="_blank" rel="noopener"
 &gt;SilverStripe 3.1&lt;/a&gt;&lt;/p&gt;</description></item></channel></rss>