symphony.pngI would like to take a few moments to talk about the very awesome and very powerful backend to airfrost v2, an unfortunately very little-known CMS called Symphony.

First, an introduction

Symphony markets itself as a CMS, but like Rails is more of a framework built on top of Ruby than, let’s say, a web app (bear with me here), I see Symphony as more of a framework built on top of XML/XSLT than a CMS. Rails has its Models/Views/Controllers structure, and Symphony has its Section/Datasource/Page/Utility structure. With both Symphony and Rails, first starting out may be tough and confusing. But once you do get the hang of them, it’s like you’re sitting on a giant maniacal robot bent on taking over the world with as little repetitive work and as much control on your part as possible. (Which, I assure you, is a great feeling.)

The aim of this introduction is to stick you on top of that robot.


Picture 1.pngBecause Symphony evolves around XSLT (eXtended Stylesheet Language Transformation), a web standard encouraged by the W3C for “transforming” XML documents into nicer looking things, you have pretty much unlimited power as to what you are able to do. Everything you see in airfrost v2—from the archives to the categories page—were coded by hand, and made possible with XSLT. With XSLT and Symphony, you not only able to add in the behavioral aspects of the site yourselves, you’re expected to do it (a “roll your own site” kinda thing).

A “theme” in Symphony is basically the entire site, with all the pages and styles intact. All that’s missing from the picture is database settings and entries (and all the other server-specific nitty-gritty). So unlike wordpress, if I send you the workspace folder (equivalent of a theme in Symphony), I am basically sending you airfrost, but sans articles. Neat, eh?

The basics of XSLT and Symphony

To understand how to make a site with Symphony, you have to first understand the basics of XSLT—which isn’t hard if you’re already familiar with scripting fundamentals (for-each loops and if statements and all that). XSLT “styles” information just as CSS styles HTML.

(Note to mac users: you can follow along with the examples below using a XSLT editing application such as TestXSLT.)

A frequently used example to explain XSLT is this: say you have a file called library.xml. In it, get this, is books in a library somewhere. You’ve also added to it (for your own reference) whether or not you’ve read the book. Imagine that it looks something like this:

<?xml version="1.0" encoding="UTF-8" ?>
<library>
    <book>
        <name>The Hitchhiker's Guide to the Galaxy</name>
        <read>true</read>
    </book>
    <book>
        <name>Sherlock Holmes</name>
        <read>false</read>
    </book>
</library>

A stroll in the park for those who are even just semi-familiar with HTML, right? Well, Symphony’s Datasources are used for making nice XML snippets just like that—the Datasource editor built into Symphony allows you to take the raw data from your Sections and turn them into XML snippets just like that one. You can then attach the XML from the Datasource to either an Utility (more about those soon) or a page. Sections in Symphony are basically mini-blogs that store entries—airfrost has three sections: the journal, the tumblelog, and the folio. You can then “transform” the XML data with XSLT, which would look something like this:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
    <xsl:output method="xml"
        doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
        omit-xml-declaration="no"
        encoding="UTF-8"
        indent="yes" />

    <xsl:template match="/library">
        <h3>Library</h3>
        <p>The books in the library are:</p>
        <ul> <!— as you can see, XHTML elements can go straight in with the XSLT —>
            <xsl:for-each select="book"> <!— goes through all the <book>'s in the <library> —>
                <li><p>
                    <strong><xsl:value-of select="name" /></strong>, which 
                    <xsl:choose> <!— an if() statement —>
                        <xsl:when test="read = 'true'">
                            you've read.
                        </xsl:when>
                        <xsl:otherwise>
                            you haven't read yet.
                        </xsl:otherwise>
                    </xsl:choose>
                </p></li>
            </xsl:for-each>
        </ul>
    </xsl:template>
</xsl:stylesheet>

All that wonderful XML and XSLT up there would result in something like this:

Library

The books in the library are:

  • The Hitchhiker’s Guide to the Galaxy, which you’ve read.
  • Sherlock Holmes, which you haven’t read yet.

So now you know the purpose of XSLT. Nifty, huh? An actual Symphony site would have a lot of similar XSLT snippets for transforming XML snippets, which would probably be used on multiple pages on your site—for example, the “Journal Entry” utility here at airfrost is used both on the home page and on the entry pages—such as this one. For that reason, Symphony has another trick up its sleeve called Utilities.

Utilities in Symphony are snippets of XSLT that can be attached to a Datasource or a page. Or both. Or multiple. Or multiple and both. Makes sense, right? Pages in Symphony are exactly what it sounds like—a page (if you’re having trouble grasping the concept, take a look at airfrost v2’s sitemap—all the links on there represent a Page on airfrost).

So there you have it—now that you’ve gotten introduced to Symphony and its concepts, go ahead and grab a copy for yourself! I wasn’t able to explain the full nitty-gritty of Symphony (and looking back, I seemed to somehow miss out completely on Masters), but if you’re interested in pursuing further into Symphony, you can certainly do so by reading the wiki, going through some of the awesome screencasts, or by reading the much more in-depth but slightly more advanced article, A Symphony Walkabout. And if you happen to run into any troubles, there even is an awesome community who will gladly help you out. Words simply can’t describe Symphony’s incredible user interface and its sheer flexibility, so please, please, go grab a copy for yourself and test it out! Now go forth and code!

928 words 16 comments

Hello! We all look forward to hearing from you!

required, but never displayed or shared! (optional, of course) http://
  • Beautiful description of Symphony! I tried it and loved it, but just couldn't get my head around the programming language, I just haven't got the understanding and sheer skill!

    Alex 2008.01.04

  • Symphony looks really nice, but I agree with Alex. It's too complex for me right now :P

    David 2008.01.04

  • Awesome site! Wonderful Symphony 101 post!

    Brian Z. 2008.01.04

  • @Brian Z: Cheers! :D

    @Alex & David: Bah, you kids these days and your Wordpress… :P

    River Jiang 2008.01.04

  • Thanks for the intro, River! I'm considering using it for my site, it sounds fun. :)

    Leo 2008.01.05

  • Nah, River, it's all about Chyrp.

    Great post, too bad I can't get my head around XLST.

    Chad Ohman 2008.01.05

  • Great overview! I echo your encouragement to give Symphony a serious look. There is a learning curve — even I haven't fully wrapped my head around XLST — but don't dismay, in the end you will be thankful you stuck with it.

    William 2008.01.05

  • Beautiful site, and great writeup. Looking forward to future articles about Symphony!

    Cena 2008.01.05

  • The backend of Symphony is sweet, but the installation and customization is just SO hard!

    I'll stick to WordPress, there's nothing wrong with it, I just think people want to be different for the sake of it.

    Ted Winder 2008.01.06

  • Ted Winder, WordPress and Symphony are very different. WordPress is blogging software that can be artificially extended through plugins where Symphony is a flexible platform for almost any kind of publishing.

    It's not about being different for the sake of it, it's about if you need the power afforded by Symphony or the ease of use of WordPress. If you're looking to run a blog, have comments, categories and possibly a few static pages then WordPress does a fine job. If you're looking to create anything else though, you'll need to look towards software like Symphony and Textpattern for their power and flexibility.

    Noel Hurtley 2008.01.10

  • The main stuff of Symphony is the custom fields and the custom types of content. I've only seen that on very big solutions running with Java… But Symphony is very young. I'm waiting for version 2 !

    Franck 2008.01.14

  • Anxious for Symphony 2 as well (when it goes open-source).

    I’m currently an avid Textpattern user (not as a blog but CMS) and I like the whole idea of xml tags. Seeing as currently I’m used to things like <txp:tag />, hopefully picking up on Symphony’s method of <xsl:value-of select="name" /> should provide for a smoother transition.

    As for the random Wordpress user chiming in, I would agree with the follow-up post that WP is just fine for your simple blog, but for anything beyond that, it’s useless. I’ve never understood why people go out of their way to try and use Wordpress as a CMS. As for ‘sake of being different’ that makes absolutely no sense at all. Quite sure Symphony doesn’t want to be just another blog-centric, security-issue-riddled system like Wordpress.

    Steve Lam 2008.01.14

  • I would just like to say that I agree that the people who don’t go with Wordpress don’t do that just “for the sake of being different”. I, personally, went with Symphony over the other excellent alternative blogging software/CMS’s because of Symphony’s sheer customizability and power. Especially with the upcoming Symphony 2.0, you can change and bend Symphony to whatever you would like it to do.

    I found that Textpattern was also fairly good for customization as well (in fact, that’s that I used for Airfrost before I found Symphony), but I just didn’t like the fact that it stored absolutely everything in its database. I like being able to edit pages and utilities and all that with simply a text editor and ftp.

    When I found Symphony, I really liked the fact that it used XSLT/XML, a web standard, for templating. (After all, at that point, it seemed as though I learnt those things for nothing. :P) It might also be because I never really delved all that far into Textpattern though–since that was one of the first CMS’s I’ve ever used, and I really had a hard time wrapping my mind around just the concept of how dynamic websites worked.

    Other than that, Textpattern is a great choice, but Symphony is perfect for me. I haven’t yet found anything that I wanted to do that was not possible yet with Symphony, and I love the feeling of being able to make an entire website from scratch without having to hand-code a CMS (which was actually one of the alternatives I considered while trying to choose a CMS to use).

    River Jiang 2008.01.15

  • OK, I;m wrong :P .

    Ted Winder 2008.01.23

  • I’ve sampled most of the blog stuff and cms tools out there. Nothing out there seemed to fit my current needs or my desire to have a multi-use platform (for free) able to go anywhere my creativity takes me as well as Symphony has. Most of the platforms out there leave much to be desired and I have very little interest in platforms that demand my attention with seemingly constant security updates and useless upgrades.

    I looked at xml/xslt at the w3schools site ages ago yet I couldn’t find many people who took the simple and clean functionality of it as seriously as Symphony programmers have.

    Thank you for your efforts and congratulations.

    I think once a person gets over the idea that there is a ‘real’ learning curve with Symphony as opposed to merely a more simple and logical way of coding/designing pages which is different, they will not only embrace Symphony, but will not look back.

    John 2008.03.08

  • FYI, the sitemap link in the article is broken.

    John 2008.10.28