Tutorials - Big bits of code to help you do more
6 May 2012 | | | Supports v2.4, v2.3Tweet
If you are sick of fumbling with TinyMCE but still want a way to include editable HTML styled content fields in the CMS then Markdown may be the answer.Continue reading...
28 April 2010 | | | Supports v2.4Tweet
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.Continue reading...
9 April 2011 | | | Supports v2.4Tweet
I recently had a request to build a multilingual site for an accountant who wanted to enter content in English, Romanian and Russian, and wanted their site visitors to be able to switch languages by clicking on the image of the country flag - and I was pleasantly surprised to learn how quick and easy it is to implement using Silverstripe's Translatable class.Continue reading...
31 May 2011 | | | Supports v2.4, v2.3Tweet
The Silverstripe blog module is great and its made its way into many of my Silverstripe sites. However, for most designers it is missing one vital aspect; an image field for each post. In this tutorial I'm going to show you how to quickly add an image to the blog module without editing any of it's files, allowing hassle free upgrading in future.Continue reading...
TutorialsWorking with Site Config
19 April 2010 | | | Supports v2.4Tweet
One of the great new features of 2.4 is the introduction of a Site Config page. This allows you to put all of those fields which are not page related, such as The sites title, root access permissions and even the current theme. The SiteConfig class is simply a dataobject and so can easily be extended to include fields, relationships and functions which you can then access from anywhere in your site.Continue reading...
7 April 2009 | | | Supports v2.4, v2.3Tweet
In this tutorial we are going to create a system that allows the Admin to decide which (front-end) page a group of users are redirected to after login. This will be defined via a TreeDropdown for each group in the security section, and can also be set to send them to the admin area via a checkbox.Continue reading...
19 April 2011 | | | Supports v2.4Tweet
Often you will want to add some extra features to your Model Admin interface. Luckily it's pretty straightforward when you know how! In this tutorial we are going to add a simple 'Duplicate' button for our managed Model.Continue reading...
TutorialsCustom sorting in the CMS SiteTree
14 February 2011 | | | Supports v2.4, v2.3Tweet
Ever wanted to sort some parts of the SiteTree? Well now you can!Continue reading...
TutorialsEmbed flash content using SWFObject
3 December 2009 | | | Supports v2.4, v2.3Tweet
There are numerous ways to embed flash content into your SilverStripe Website. A commonly used and very flexible method to embed flash is provided by the SWFObject script. In this snippet I'll show you how to create a custom FlashPage that will contain flash content, embedded using SWFObject.Continue reading...
13 October 2010 | | | Supports v2.4, v2.3Tweet
This post title may look familiar, but it has in fact been completely re-written with lots of new code! When using dropdown menus, you will often want to dynamically generate the options, usually to a list of DataObjects or Pages for the user to choose from. This tutorial explores the options at your disposal when it comes to creating dynamic dropdowns in the SilverStripe.Continue reading...
TutorialsAdding a CMS action
1 September 2009 | | | Supports v2.4, v2.3Tweet
If like me you cannot figure out how on earth to use the updateCMSActions() function in a decorator and you also can't get the getCMSActions() function to find your custom method inside the controller then here is a way to make it work, which will allow you to create custom actions and buttons to trigger those actions within the CMS.Continue reading...
7 October 2011 | | | Supports v2.4Tweet
With only the standard Broken Links Report, the report admin area in Silverstripe's CMS can feel a bit underused. In this tutorial I'm going to take a look at how you can add a custom report into the report admin section of the CMS which can make keeping track of a variety of statistics a little more straightforward.
To keep this simple I am going to give users the ability to assign a colour to each page on the site and then generate a report of any pages on the site that have been assigned a particular colour.Continue reading...
24 July 2009 | | | Supports v2.4, v2.3Tweet
The default install of SilverStripe contains an array of buttons for the TinyMCE HTML editor. However usually your client will need some extra functionality or you may want to keep things simple for them by removing some of the buttons. As of SilverStripe 2.3.2 this is very easy and can be achieved by adding some code to the _config.php file.Continue reading...
15 January 2011 | | | Supports v2.4Tweet
One way to change the MetaTags dynamicly is to add a lot of template controls to display different MetaTags for each view, but you can get a lot more flexibility by overriding the SiteTree MetaTags function in your Page_Controller.Continue reading...
28 July 2009 | | | Supports v2.4, v2.3Tweet
Most of my customers don't want to add meta info manually, so I add an onBeforeWrite() function to update the Meta Description field and count the keyword density of the content with a separate function and add these keywords to the Meta Keywords fields when a page is saved.
In my humble SEO opinion every page needs an unique Meta Description. Keywords seems to be less important for search engines, but why not add them automatically anyway! The function counts how many times each word exist in the Content, order the words by occurrence and glues the words to a comma separated string. In this function only words with more then 4 characters are counted, but you can adjust that if you like.Continue reading...