Information, tutorials, code tips and how tos for programming the SilverStripe CMS
SilverStripe is a free open source content management system that is coded in PHP and supports MySQL, Microsoft SQL Server and Postgres as database backends. It contains the Sapphire model-view-controller framework and is extremely extendable. There are a number of modules, themes and widgets abailable and it is easily customisable. The admin interface is slick and can also be customised with additional tabs and fields depending on the page types.
Be sure to check out the online documentation and SSBits.com. The latter is full of all sorts of useful tips and tricks and is worth spending time looking through after reading the docs.
Post sort order: Post Date (Newest First) | Post Date (Oldest First) | Alphabetical | Date Updated
Posted February 8th, 2013 in SilverStripe
New Zealand Government websites will switch to Silverstripe, the free, open-source CMS/framework from Wellington company Silverstripe under an "all-of-government" contract.
Posted December 12th, 2011 in SilverStripe
The SilverStripe 2.4.x CMS uses TinyMCE as the WYSIWYG HTML editor and comes with the Paste plugin for reformatting pasted text. Unfortunately the version that comes with SilverStripe 2.4 is fairly out of date and doesn't handle pasting very well in webkit based browsers (or at least for me on Chrome on the Mac).
Posted June 15th, 2011 in SilverStripe
When inserting an image into the TinyMCE HTML editor in SilverStripe it doesn't prefix the src attribute of the img tag with a leading slash leaving it like e.g. src="assets/images/myimage.jpg". This is acceptable because it writes out a <base> tag into the document <head> so these relative urls are made into absolute URLs using the href in the base tag. However, as I have found, some bots ignore the base tag and are unable to grab the images correctly. This post shows how to modify your base page class in SilverStripe to prefix assets with a leading slash.
Posted June 13th, 2011 in SilverStripe
The SilverStripe CMS html editor uses TinyMCE which strips out style attributes for the image tag by default. Fortunately it is very easy to prevent this from happening if you want to be able to assign styles directly in the HTML to an <img> tag. Whether or not you should actually add inline styles is a different post altogether :)
Posted June 7th, 2011 in SilverStripe
SilverStripe 2.4 - Module Extension, Themes and Widgets is a just released book by Philipp Krenn and published by Packt Publishing. The title of the book is slightly mis-leading but only because it gives an excellent overview of SilverStripe as a whole, not just dealing with modules, themes and widgets.
Posted June 5th, 2011 in SilverStripe
SilverStripe allows default values to be set for fields on data objects using the static $defaults property but this cannot be populated with dynamic values, such as using date() or rand(). Instead use the populateDefaults() function.
Posted April 29th, 2011 in SilverStripe (Updated May 7th, 2011)
SilverStripe is a PHP based CMS system. When logged into the admin part of the site there's a navigator bar that appears fixed at the bottom of the page allowing the editor to easily edit a page in the CMS, or toggle between the draft and published version of the site. This post shows how to relocate the SilverStripe navigator bar to the top of the page.
Posted April 6th, 2011 in SilverStripe
SilverStripe's File, Folder and Image objects have a default sort of 'Name', 'Sort' and 'Name' respectively, but if you are also using Uncle Cheese's DataObjectManager the sort order will change to the 'SortOrder' field. Unless you've been sorting these yourself they're going to appear in the ImageField control in a more or less random order, which isn't idea. This post shows the solution.
Posted March 25th, 2011 in Offsite Articles and SilverStripe
I use SilverStripe for a number of my websites and find the tree tools in the the site tree area annoying how it scrolls out of view when scrolling through a large set of pages. This post shows some screenshots of the issue and solution, and links through to the solution at SSbits.
Posted February 18th, 2011 in SilverStripe
This post shows how to relocate the "Unpublish" and "Delete from the draft site" buttons away from the "Save" and "Save and Publish" buttons in a SilverStripe installation without modifying the core SilverStripe files.
Posted January 5th, 2011 in PHP and SilverStripe
The SilverStripe/Sapphire CMS/Framework uses TinyMCE as the HTML editor. Normally to set configuration options for TinyMCE you would do it in your own tinyMCE.init() call, but in SilverStripe this is called dynamically in PHP in core Sapphire code. There's a simple way to add configuration options as shown in this post.
Posted December 29th, 2010 in PHP and SilverStripe
This post looks at the minimum PHP version requirements for SilverStripe. I will update this page as new versions are released and I upgrade the various SilverStripe websites I manage, noting any issues I experience.
Posted November 13th, 2010 in SilverStripe
When moving a SilverStripe site from one server to a differently configured one we came across an odd bug where some content from the SSViewer.php file would render in the output the first time that template was requested but not on subsequent requests.
Posted August 9th, 2010 in Quick Tips and SilverStripe
This is just quick little post for self reference to show how to escape values which go into a raw SQL query in SilverStripe; I find myself never being able to remember this and having to always look it up.
Posted August 3rd, 2010 in SilverStripe
SilverStripe date fields have a number of functions that can be used on them in templates; one of these is the InPast function which unfortunately appears to have a bug in it (at least in SS 2.4.0 and 2.4.1). This post looks at the issue and the workaround I created.
Posted May 23rd, 2010 in Quick Tips and SilverStripe
Any page on a SilverStripe website can have comments on it and can easily be passed through the Akismet spam filtering service to check if it is spammy. This quick tip shows how to enable Akismet in SilverStripe after you've got an API key.
Posted May 19th, 2010 in Quick Tips and SilverStripe
By default SilverStripe comments do not require moderation i.e. all comments are automatically approved and displayed on the site. This quick tip shows how to enable moderation in a SilverStripe install so the moderator has to approve all comments before they are visible.
Posted May 11th, 2010 in Quick Tips and SilverStripe
It's funny how we programmers don't tend to read documentation (well I often don't tend to anyway - at least not cover to cover) and turn to search engines to find the answers to our questions. When looking for something quite different from what this post is about I stumbled across the SilverStripe templates documentation page and discovered how to put comments into a SilverStripe template that will be stripped out of the published site. So here's a quick tip to point it out to those of you who use SilverStripe and may not already know this.
Posted March 13th, 2010 in SilverStripe (Updated April 16th, 2010)
SilverStripe by default creates a directory for caching the site manifest etc by using the PHP function getSysTempDir(). It is possible to locate this directory elsewhere by simply creating a directory called silverstripe-cache in the website's root directory, or at any other location by setting the TEMP_FOLDER constant.
Posted March 6th, 2010 in SilverStripe
I needed to put some text directly next to a placeholder in a SilverStripe template and couldn't find the answer in the online documentation or the SilverStripe book, but perhaps I missed it. In any case, I worked it out from a user comment so show here how to do it.
Posted February 25th, 2010 in SilverStripe
I was getting the error message "Error saving content" when publishing an error page in the SilverStripe CMS and couldn't work out why. The changes were being displayed in the front end so the error message seemed kind of odd.
Posted February 24th, 2010 in SilverStripe
If you have lost the admin login details for a SilverStripe installation and sending an email to reset the password is not working, there is a default admin account that can be enabled. After logging in, reset the regular administrator's details and then remove the temporary login as shown in this post.
Posted February 23rd, 2010 in SilverStripe
When logged into the SilverStripe CMS admin or viewing a SilverStripe on a development site there's a box with a red background that is positioned absolutely showing whether this is the published or the draft version of the site. This post shows how to override the styles for this box.
Posted February 21st, 2010 in Apache and SilverStripe
The default .htaccess file for SilverStripe runs all URLs that do not belong to actual files on the filesystem through the Sapphire framework. This means that if a request is made for a CSS file that does not exist, for example, it will be run through SilverStripe/Sapphire, which is not really necessary.
Posted February 20th, 2010 in SilverStripe
When you open up your web browser to a SilverStripe install for the first time there's an installation process that needs to be run. This requires several permissions to be set correctly when running on a *nix based host so this post has the commands needed to quickly make these permissions correct, and then switch them back and clean up the redundant files afterwards.
Posted February 19th, 2010 in SilverStripe
I ordered the SilverStripe book "SilverStripe: The Complete Guide to CMS Development" from Amazon.com on Friday last week and received it yesterday morning. I'll review it properly once I've finished reading it cover to cover (probably by the end of the weekend) but for the moment wanted to have a look at Amazon's delivery estimations.
Posted February 18th, 2010 in SilverStripe
After installing SilverStripe there are a whole bunch of files in the site's root directory which are no longer needed and can be deleted. This post lists which files are safe to delete.
Posted February 16th, 2010 in SilverStripe
The SilverStripe CMS makes it very easy to have a slightly different layouts between pages by creating another page type and using $Layout with different layout templates. I did this for the Fabco Ltd website which is a small website with a larger main image on the homepage and a smaller version of this image on the subpages; in all other respects the templates are the same.
Posted February 15th, 2010 in SilverStripe
If you follow my blog you will have seen in the last three days a few posts about the SilverStripe CMS system. I've just started using it and am creating a big portal site with it along with converting some of my existing websites and creating some new sites with SS.
Posted February 13th, 2010 in SilverStripe (Updated February 14th, 2010)
When I was setting up a new template for a SilverStripe based website I was suddenly no longer able to access the admin area. I got the login form but after logging in I kept getting a page not found error when the web browser was trying to access/Security/Security/LoginForm
Posted February 12th, 2010 in SilverStripe
During the course of this week I've been looking at a number of different PHP CMS systems and frameworks, compared with developing an in-house one, for creating a huge new motorhome travel portal. After some consideration I've decided on using SilverStripe.