SilverStripe

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.

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).

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.

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 :)

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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

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.