Tutorials - Big bits of code to help you do more
TutorialsWeb 2.0 Mirrored Images
2 November 2009 | |Tweet
Ever wanted to create the so-called 'web 2.0' mirrored images as you can see on http://www.dio5.com/portfolio/, without having to manually rotate and proces the image? Then this one is for you.
I have attached a fully working zip-package, but let's run through some of the code nonetheless.Continue reading...
21 September 2009 | |Tweet
Something that has been bothering me when building larger sites with SilverStripe is that I often find myself creating new classes not to add functionality, but to just get a new template.
You can set separate templates for different actions manually but that's not what I want in this case, I want different templates for the same action on the same class.
After thinking about this for awhile I came up with a two part solution and the first part is to make the template choosing aware of the Sitetree hierarchy.Continue reading...
11 September 2009 | | | Supports v2.3Tweet
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...
TutorialsCreate a front end theme switcher
17 August 2009 | | | Supports v2.3Tweet
So you wanna make a demo site for your customers to show all your template skills in one site. A simple theme switcher can come in handy. It's quite easy to implement this.
First add two new functions to your Page_Controller class: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...
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...
TutorialsWorking with banners
13 July 2009 | | | Supports v2.4, v2.3Tweet
Most of the sites I work on are for corporate/business clients and there is not typically a lot of fancy motion graphics going on. I do like to ensure there is some dynamic element going on, just to provide a bit of interest and one of the simplest ways to achieve this is by some variation of the random/rotating banners scenario. Of course this could equally apply to other parts of the page, not just banner graphics.Continue reading...
28 June 2009 | | | Supports v2.4, v2.3Tweet
When you have a number of pages which follow on from one another you may find that asking a user to return to an index or select the next item from a side menu each time they want to progress is cumbersome. In this situation having previous and next buttons at the bottom of a page becomes very useful. In this snippet we'll add these buttons and also a counter to show the current page we are on and the total number of pages.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...