Building the Web Your Way

A Journey Through a Content Management Framework

wilkerson-book.jpgMODx is a free, open-source Content Management System and Framework, developed and supported by MODX LLC and a large global community. The latest iteration of MODx, called Revolution, is fully object-oriented, and is based on xPDO, a free ORM/ORB extension of the PHP PDO libraries. At this writing, it supports MySQL, MSSQL, and SQLite databases. PostgreSQL and Oracle support are under development. While basic sites can be built quickly with a default installation of MODx, its greatest advantage lies in its modular extensiblity, offering the designer and developer unlimited scope for individual creativity and purpose. To take full advantage of the power of MODx, the developer needs to learn how MODx works and how to use its building blocks to extend it to satisfy his purpose. While there is official documentation and a number of websites with tips and tutorials, as well as a very active and friendly forum, for the dedicated developer there are two major publications that it is good to be aware of - BobRay's "Official Guide", and W. Shawn Wilkerson's "MODX Revolution - Building the Web Your Way".

Get the Book

W. Shawn Wilkerson had been an active member of the MODx community for over six years when this book was published and continues to be a long-time MODX user. He has contributed useful add-ons such as ListIndexer, for listing recently added pages.  He is the founder of Sanity LLC, a technology integration company, and holds 9 degrees in programming and web design. His book on MODx Revolution, subtitled "A Journey Through a Content Management Framework", was published in August of 2012 by Sanity Press, with ISBN 978-0985853204. It has some 600 pages, divided into 5 sections:

  • Foundations - containing seven chapters introducing MODx, the Manager interface, and describing each of the MODx building-block elements.
  • Live projects - five chapters that walk through real-world web development projects.
  • Development - four chapters discussing the programming APIs, the xPDO foundations of MODx, and working with third-party add-on packages.
  • Appendix - six sections of MODx-specific terminology, system settings, object schema listings, and other useful bits of information on how MODx works.

Foundations - MODx and the Manager

The first chapter introduces what MODx is (and is not), highlighting the complete freedom it offers the web designer and developer. Use MODx as it comes for nearly instant, fully-functional sites, or turn it into a framework for complex web applications.

The second chapter introduces the Manager interface. It points out that the Manager itself is built with the core MODx framework, and so is completely customizable and even totally replaceable. Then we are taken step-by-step through the Manager, with each feature and function explained. Of special importance is the tree structure that lists the content resources that provide the main content elements for each page, the tree structure reflecting the overall site structure. This is an excellent place to start for new MODx users.

Foundations - Elements

the next five chapters discuss each of the five basic building-block elements that are used to build a MODx site. The coverage of these elements is by no means superficial, everything from customizing the Manager forms for them to how they are stored in the database to how to format and manipulate their final output on your web page is explained. Plenty of actual useful code samples and in-depth explanations make it easier to understand how MODx builds up a site using these modular blocks of content and content-generating elements.

  • Templates - The HTML structure that forms the skeleton of each page. This can be any HTML page, simply replacing the dynamic content areas with appropriate MODx tags. Best practices are emphasized so that a developing site will be organized and easily maintained.
  • Chunks - Blocks of HTML code that can be used and re-used in multiple locations. Suggestions for the most effective use of these handy little snippets of HTML are offered.
  • Template Variables - Custom fields to create and use for specified pages. Extremely powerful, these can provide any kind of input fields, and can use PHP code to provide input option fields or default values. How to process and format the output of these custom fields is covered.
  • Snippets and Plugins - PHP code for generating dynamic content such as menu structures or processing submitted forms, and manipulating the core MODx functionality without modifying the core code. The core is riddled with event triggers that are used by Plugins to insert custom code at those points, such as when a page is requested, when a user logs in, or when a form in the Manager is submitted.
  • Modifiers - modifying and manipulating the output of any element. Useful for simple conditionals, providing default output, or applying more complex processes such as resizing images.

Live Projects

The Quick Start chapter walks through the simple procedure to create a basic website after installing MODx, from a few basic System Settings such as a name for your site, through setting up the Template for your pages and assigning it to the Resources that will provide the main content for the pages,using Chunks and Template Variables to add dynamic content to your pages, and installing and using third-party add-ons via the handy Package Manager. A complete site, with search functionality and a contact form can be set up in less than an hour, using any one of thousands of free HTML templates as the base Template.

The rest of this section goes on to show how, among other common Web essentials such SEO, AJAX, friendly URLs and .js and .css minification can be easily arranged, to how a full-blown blogging platform can be created in a few mouse clicks.

Administration

The first Appendix provides a comprehensive listing of MODx Revolution terminology, from Add-ons to User Settings.

Next we have a list of the Resource fields, such as pagetitle and content, and the System Settings with their default values, such as site_name and friendly_urls.

Appendix C consists of a series of quick cheat sheets of the primary objects and their relationships, which will be of use to developers.

Appendix D contains a description of how the document parser and the caching mechanism works.

Appendix E discusses of various forms of Internet caching, pros and cons.

And finally, Appendix F is an interesting list of 19 "rules", shared nuggets of hard-won programmer philosophy, to keep in mind that would be useful for any web developer.

Conclusion

The book is clearly based on a strong understanding of programming, web development, and of MODx Revolution itself. One thing I especially appreciated about the layout of the book is the extra large font used for the code examples. It doesn't make for a pretty layout, but it's a great improvement in usability over the usual prettier blocks of small, often hard-to-read text. While typos and grammatical errors are common, this was understandably explained by the need to get such a book published and available before the fast movement of the web development world in general and MODx in particular make it at least partially obsolete. But since this was the only nit-picky criticism I could find, ultimately I definitely want to say that this is a book that every MODx Revolution developer should have on his desk. The book can be purchased directly from Sanity Press, or from Amazon.

← SSH/SFTPModxphpMyAdmin on MAMP →