September 9, 2014#

Working with SilverStripe without the CMS

Most users, and even developers only really Silverstripe as a great CMS (Content Management System). While that is true, it also a framework and can be used even without the CMS module installed.


Well this isn’t for everyone that use Silverstripe, but sometimes its nicer not to have the overhead of the CMS for something you are working with, especially if its more web app based rather than a website. Also if you really like the admin area of Silverstripe you needn’t worry as it is now mostly baked into the Framework module so removing the CMS doesn’t remove this feature as of SS 3.0. The biggest benefit in the CMS is maintaining the menu(and of course the page content), so if you really don’t do that all that much than working without it might be an idea..

In Silverstripe 3.1, it is now way easier to do this, especially if you are using composer, just don’t include it in your composer.json file!

Now we need to do add a few things to our installation so we can start working in the framework.


As we don’t have any CMS to help us look up pages, in the DB we need to tell SS where to grab our content. Here is an example of a routes.yml (place this in _config folder in your mysites or project folder) file of a simple 3 page site.

After: framework
"": HomeController
"home": HomeController
"about": AboutController
"contact": ContactController

Once we have these in place, and after /?flush=all we need to create our controllers to render some content.


Like any MVC framework, Silverstripe uses Controllers to dispatch and return the work of our application. Above we would need to create 3 new Controllers named ‘HomeController’, ‘AboutController’ and ‘ContactController’ which all extend Controller.


 class HomeController extends Controller {
  public function index() {
    echo 'Hello World';

The ‘index’ function is called by default on a controller, so now if you were to visit http://yourwebsite.blah/home, you should now see something.. of course with a little help from our friends ‘flush’ and ‘all’ you’d see something pop up in your browser.


Without the CMS you don’t have access to creating and editing a menu. To get around this I would also recommend creating one more controller which oversees our controllers above. Lets call this SiteController, and this can house the menu system.

class SiteController extends Controller {
 public function Menu() {
  $menu = new ArrayList();
  $siteClasses = ArrayLib::flatten(ClassInfo::subclassesFor('SiteController'), false);
  foreach ($siteClasses as $siteClass) {
   $inst = singleton($siteClass);
   $active = false;
   foreach (self::$controller_stack as $candidate) {
    $active = $candidate instanceof $arcClass;
   $menu-&gt;push(new ArrayData(array(
   'Title' =&gt; $inst-&gt;Title(),
   'Link' =&gt; $inst-&gt;Link(),
   'Active' =&gt; $active,
   'Sort' =&gt; $inst-&gt;menuSort()
  return $menu-&gt;sort('Sort ASC');

You can then loop the menu in your SS template file as you would normally. e.g.

      <% loop $Menu %>


  • class=”current”<% end_if %>>$Title <% end_loop %>

That is all.

Please keep in mind this is a VERY barebones example of how to get things in Silverstripe working without the CMS installed. I plan on releasing a module to help people get off the ground faster from a few tricks I have learnt with the current project I am working. Please get in touch in the mean time if you would like to ask questions as I know there is very little documentation out there on the topic of Framework only work in Silverstripe.

July 12, 2012#

Sold on SilverStripe

I’ve been working in SilverStripe for the last 3 months and have fallen completely for the CMS/Framework.

I have been working in Joomla for several years now and I have struggled with its lack of development continuity.

I came across SilverStripe after it being recommended several times by a friend of my work colleagues. The learning curve for SilverStripe is very small and within a couple of hours I already had good grasp of the administration and  extending the core code to develop custom solutions. Extending a SilverStripe site centers around its core ORM. After developing a new Object called a DataObject in SS, you can define a set of static variables which map to a database table after running the build process on the site. So simple and fast that your can have a site with advanced features up and running with full CRUD commands accessible through a great UI within hours.

I am currently in the process of moving all sites at Stray and Spaceships over to SilverStripe so watch this space for further developments and learnings of the fantastic framework.

May 31, 2010#

Displaying Error Messages in Joomla

I found this code quite handy when developing components and displaying error messages to users.

//Get a handle to the Joomla! application object
$app =& JFactory::getApplication();
//add a message to the message queue
$app->enqueueMessage( JText::_( 'Some error occurred' ), 'error' );

/** Alternatively, in PHP 5 */
JFactory::getApplication()->enqueueMessage( JText::_( 'Some error occurred' ), 'error' );

July 25, 2009#

Joomla Component

Hi All,

I am in search of a cool Joomla Component to build, any ideas?