Filtered By: All Categories

Content Exchange

Smart solutions for integrated marketers

Article
The Power of a New Templating System
Monday, July 16, 2012

The Power of a New Templating System

By P.J. Hinton Director of Engineering

The task of maintaining a medium-to-large size website is daunting, and trying to do it manually can lead to all kinds of problems, including broken links, missing assets, and inconsistent appearance.

Content management systems address this problem by providing a templating system, which specifies how dynamically generated content will be laid out among otherwise static assets. 

The simplest templating systems work very much like mail-merge word processor documents, inserting fields from a database into select locations.  More sophsiticated systems allow for styling adjustments or even drag-and-drop layout management.

screen shot of Compendium's new template managerOver the past five months, our team has been developing and refining a brand new templating system, which is replacing the system we've had in place for the previous four years.  We're using it to render our own Content Hub, and new clients will be using it as a starting point.  

The new system is built upon a newer PHP-based templating system called Twig, which is a product of Sensio Labs.  We chose it to replace our existing XML rendering system for several reasons:

  1. Less Stringent Syntax  -- Under the old templating system, syntax mattered everywhere because XML processors require that the document be "well formed" with respect to XML's syntax rulres.  With the new templating system, syntax matters only in the areas where Twig is actually executing code.  In principle, one could use the saved HTML from a company's website as a starting point for a new template on the new system.  On the old templating system, lots of manual adjustments were required. 
  2. Still Secure Against Arbitrary Code Execution -- When we designed the XML templating system back in 2008, one of our requirements was that it had to be safe against the execution of arbitrary  code, which is the bane of existence for many free blogging applications.  Not protecting against this vulnerability would make our platform less secure.  With ill-tested code, one bad template could quite possibly take down an application server.  Unlike other PHP systems, Twig provides robust sandboxing, which prevents the insertion of harmful code.
  3. Better Flow Control Handling -- More sophisticatted designs require lots of conditionals and loops.  Conditionals ensure that certain things are displayed only on the right circumstances.  Loops provide a succint means of communicating repeated operations, like the display of posts.  With the old XML system, loops and conditionals had a very awkward syntax, which borrowed heavily from XSL, an XML language for transforming XML into something else.  Twig's elegant syntax makes expressing these operations a breeze.
  4. Nesting of Templates -- With the old XML-based system, all possible markup that could appear on a page had to be expressed in one XML document.  Twig allows for embedding template assets within other templates, making it possible to split out the header, footer, and other sections of a page into separate files.

But Wait!  There's More!

Our user interface for managing Twig templates is a huge value-add, which includes the following benefits:

  1. Easier Asset Management -- Asset files, like style and images, can be uploaded and managed easily through the user interface.  Under the old system, these assets had to be hosted elsewhere or uploaded through other parts of the application.
  2. Easy-on-the-Eyes Code Editing -- Editing XML source in the old templating system was a task for only the bravest of the brave.  Aside from the default indentation at the start, there was little to go on.  The new system uses the Ajax.org Cloud9 Editor, which provides syntax coloring, a nice way to communicate the role of the code on the page.
  3. More Widgets with More Configuration Options --  A template widget is essentially collection of markup, styling, and behavior, which specfies a frequently used page component, like a post listing or a call-to-action image.  The new system introduces new widgets, like the post archive link listing, and many of the widgets are configurable by the network administrator outside the context of the template editor, making it easier for non-designers to make small updates to the site.

All of these things make it easier to create a content marketing hub that matches your brand in a shorter amount of time.  Moreover, it's much easier to maintain.

Does your content marketing software provide you with this much control at this level of simplicity?  If not, then consider getting in touch with our sales team to learn more about this and many other benefits of using Compendium!

Recent Posts

  • Article
    Friday, May 24, 2013

    B2C Content Marketing Example: Simon Malls' Style Setter

    When it comes to content marketing, some companies are simply 'getting it right'. Simon Malls is one of these companies. Through their Style Setter blog and content marketing strategy, Simon effectively engages with customers and provides relevant, informative content visitors want to consume. Through a diverse content focus and an emphasis on...

    Melanie Ramsey
    Account Manager
  • Article
    Thursday, May 23, 2013

    Developing Your Dashboard: Tips for Reporting Content Marketing Metrics

    The suits in the C-suite demand reports from their department heads, and content marketing directors are no exception. (Your clients want to know what’s happening as well.) But while executives understand sales reports and financial spreadsheets, dashboard metrics are often a foreign language. Here are some ways to translate your work in ways...

    Clayton Stobbs
    Director of Account Management
  • Article
    Wednesday, May 22, 2013

    7 Ways to Turn Customer Stories into Content

    Ah, a happy customer. Telling their story is still the best form of marketing. So, what are you doing to actively collect the stories of your happy customers? Here are seven things you can start doing today: Listen. How many opportunities for collecting stories go unnoticed because you’re focused on the delivery of your product, service or promise?...

    Jim Brown
    Senior Account Executive

READY TO See Compendium? REQUEST A DEMO

×