Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Richard is a designer/developer/strategist/coffee addict/twitter junkie/slash/slash/slash. He's been working with SilverStripe since 2009 and recently started his own company design + awesome, but really needs to find time to build his site. Find him on twitter @thezenmonkey

Content is the basis of all great sites, and without a content plan it's easy to get bogged down and lost in adding data fields or relations to your SilverStripe classes.

I'm sure many of you work with a content outline when starting a new project. A document where you keep track of all your DataObjects and Pages, and the fields and relations in them. See Future-Ready Content and Strategic Content Management for some great background info. I experimented with different methods of building outlines (flowcharts, lists, tables), but I always found myself resorting to nested lists, partially for their simplicity, I don't get bogged down in making them look pretty, and partially because they can match PHP code. I was doing them originally in Word or a text editor, but I found OmniOutliner to be a great tool. I can create templates and use multiple columns to speed up organization, plus there's both desktop and iOS versions so I can work on the go.

I have these content outlines, so I can easily see how my site is shaping up and I can send them to clients for approval, but I still spend a lot of time copy and pasting array keys and values into my PHP files. Since the outlines are already structured like SilverStripe classes I just need to turn them into PHP.

In true hacker fashion I figured, "hey, why can't I just script this tedious process?". All hacker's and DIY junkies are inherently lazy at a fundamental level.

 

 

 

 

 

 

So here's where AppleScript comes in. Most Mac apps are scriptable and the language actually parses like plain english, so it wasn't hard to go from no knowledge of AppleScript to working script in a few hours. Most of that time was spent going through the OmniOutliner AppleScript "dictionary" trying to figure out the best way to parse the document.

Basically the script goes through an OmniOutliner file that defines your class names, their extensions and any $db variables and relations then automagically creates the PHP files. We take a document you should be creating anyway, and build your code from it. No duplication of effort, no tedious copying and pasting, no need to remember the correct syntax for Emum fields. Great for people just starting out with SilverStripe, or if you just want to save a little time.

All you need to do is download the script from github, open it in the AppleScript Editor and save it as an application. Then just download the OmniOutliner template and build your outline document. Finally, drag that file onto your AppleScript Application, pick a directory and let the script do its thing. Easy.

SilverStripe is a great CMS for building content rich sites, and with a solid content model, some good planning and few easy to use tools we quickly create sites that go beyond the post/page model.

Other great articles on Content Modelling