Home - Your one stop SilverStripe learning resource
- Show all
- Site Tree
- Site of the Month
- Model Admin
- SilverStripe 3
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...
SnippetsSpice up Your CMS Sitetree
27 August 2009 | | | Supports v2.4, v2.3Tweet So you have created your own page types, but they all look the same in your CMS site tree. Time to make them more recognizable! This is quite easy, but it can make your site tree a lot more attractive. Continue reading...
22 August 2009 | |Tweet I managed to forget my admin password and found quite a few ways to unlock an SS install. I originally thought about poking around the database and changing the hashes myself. After reviewing the Security and password encryption code, I would recommend against doing that. SilverStripe uses salted SHA1 encryption which is no fun to try and create yourself. Also you'd have to update multiple tables to get the password changed. Luckily the SS Core team has included multiple features for accomplishing this. The options below assume you have access to your webserver to use some PHP code. 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...
5 August 2009 | |Tweet
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...
16 July 2009 | | | Supports v2.4, v2.3Tweet
Often you will want to manipulate every nth item inside a <% control %> loop. For example say you had a gallery and you wanted every 3rd image to start on a new line, you need to be able to test each item from the template to see if it is divisible by 3 and should therefore have the clear CSS class added to it.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...
3 July 2009 | |Tweet
If you want to remove an item from the CMSTopMenu without making it inaccessible you can add this line to your _config.php file:
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...
23 June 2009 | | | Supports v2.4, v2.3Tweet
Often you will want to control which users can create, edit, delete and publish certain page types. For example you may only want high level users to be able to create ContactPage page types, or prevent low level users from deleting HomePage page types. This can easily be achieved by adding these functions to the page type model (usually just before getCMSFields()). Then within the function you can define conditionals which decide whether to return true or false.Continue reading...
SnippetsChanging the CMS Help Link
10 June 2009 | |Tweet
Usually you can change the CMS menu settings from your site configuration, but the "Help" link is hard-coded to allow for translations. This snippet, placed in your site configuration file will override the "Help" link with a link back to your site:
CMSMenu::add_link('Help', 'Home', Director::baseUrl());Continue reading...
25 May 2009 | | | Supports v2.4, v2.3Tweet
Although ultimately requiring very little code, displaying data from a set of pages on another page can seem confusing for those new to SilverStripe. This example will display all of the Images from all the staff pages on our current page. This works by first returning all the staff pages to our template and cycling through each of them, drawing the Image for each one.Continue reading...
21 May 2009 | | | Supports v2.4, v2.3Tweet
This snippet lets you add a thumbnail to items in UncleCheese's Data Object Manager module or a regular Complex Table field. All you need to do is create a function that returns a thumbnail and refer to this function in your DOM or CTF definition.Continue reading...