#native_company# #native_desc#

ExpressionEngine Enhances PHP Content Management with Framework Flexibility

By W. Jason Gilmore
on March 28, 2010

Over the years , I’ve used quite a few of these content management systems, in addition to building a variety of custom solutions using tools such as the Zend Framework. Both approaches have their drawbacks, with the former never seeming to offer an adequate level of flexibility while the latter requires a great deal of redundant coding and long-term maintenance. Granted, neither approach is intended to cater to every desire, but can you blame me for wanting such a solution anyway?
Indeed, I concluded that no solution effectively offered both the fundamental features of a content management system and the flexibility of a web framework. However , after working with ExpressionEngine (one of the systems I recently highlighted in my article “The Top Five PHP Content Management Systems“), my opinion on this matter has fundamentally changed. Using ExpressionEngine during the past few months on a major project that involves a great deal of multimedia and downloadable content, an existing membership base numbering in the thousands, and a complex e-commerce configuration, I’m starting to believe perhaps you can have your cake and eat it too.

ExpressionEngine Defined

Although ExpressionEngine is considered the latest significant entry to the crowded PHP content management system market, the company behind ExpressionEngine is anything but inexperienced when it comes to developing powerful software. In fact, EllisLab is the creator of pMachine, which was one of the first PHP-driven content management systems and was the precursor to ExpressionEngine. They also created and lead the CodeIgniter project, one of the world’s most popular open source web frameworks. However, you don’t need any prior knowledge of CodeIgniter in order to begin using ExpressionEngine, or even of PHP for that matter. You can build a fairly powerful web site using the content management tools made available through its web-based interface.
ExpressionEngine does differ significantly from other leading PHP content management systems in its licensing. Although a free version is available (known as the Core License), you can use it only in conjunction with “personal, non-commercial, and non-profit activities.” For commercial purposes, you’ll need to purchase a commercial license, which currently runs $249.95. Frankly, I found this a small price to pay given the significant time that key ExpressionEngine features saved me. These features are discussed in detail next.

Key ExpressionEngine Features

Hundreds of features are bundled into ExpressionEngine (itemized here), however I found a few particularly striking as compared with what other solutions offer.

Intuitive Content Management

ExpressionEngine treats all content as a Weblog, pure and simple. Therefore, if you were tasked with creating a site that cataloged information about books, DVDs, and video games, you would probably create three Weblogs, one for each product type. Of course, each Weblog would consist of custom fields specific to the content it tracks. For instance, each book entry would probably contain fields used to represent the book’s title, ISBN, author, page count, publication date, price, and table of contents. ExpressionEngine allows you to easily customize these fields for each Weblog, defining not only the field title but also the type of form control that should be used to manage the data. Figure 1 depicts just such a set of fields for a book-related Weblog.

ExpressionEngine Enhances PHP Content Management with Framework Flexibility
Click here for larger image

Figure 1. Customizing Weblog Fields

A Flexible Templating Engine

When you’ve defined the Weblog fields and added a few entries, you can create the templates, which will format each Weblog entry within the web site. This is accomplished using a highly intuitive template engine, which allows you to refer to the Weblog field names (see Figure 1) within your templates, as demonstrated below:

<div class="book-summary">
  <img src="/images/products/{segment_3}.png" />
    <b>By</b>: {authors}<br />
    <b>Publication Date</b>: {entry_date format="%F %d, %Y"}<br />
    {if isbn != ""} <b>ISBN</b>: {isbn} <br /> {/if}
    {if pages != ""}  <b>Pages</b>: {pages} {/if}

Rendering this template to the browser produces output similar to Figure 2.

ExpressionEngine Enhances PHP Content Management with Framework Flexibility
Click here for larger image

Figure 2. Rendering an ExpressionEngine Template
These templates are managed within a web-based console (see Figure 3), and can be easily configured to rely upon a unified page header, footer, and context-specific sub-templates, such as sidebars.

ExpressionEngine Enhances PHP Content Management with Framework Flexibility
Click here for larger image

Figure 3. Managing ExpressionEngine Templates Through the Web-based Management Console
Finally, if the native template tag capabilities don’t suffice, you are free to integrate both PHP and custom SQL queries into your templates, stretching the boundaries of content management as far as you’d like them to go.