Building a New

By The MODX Team
January 10, 2006
Building a New

MODx really blows me away. I was reminded of this yet again recently while working on the new site template with Zi. I'm really lucky: the amazing team on this project keeps cranking out killer stuff, and it's fast approaching making building sites almost effortless. (Except for the CSS side ... but we have IE6 to blame for that ... )

Take the new @INHERIT binding for example. It quite simply rocks.

(For those of you that need a primer, a Template Variable – "TV" for short – is simply a custom content field that is assigned to a template. The cool thing about how MODx handles custom fields is that they can be programatically built via a technology we call @BINDINGS. These let you use logic or dynamic data to build the values, assign sophisticated transformations to the input or output formats, and other really cool stuff. Trust me, once you get them, they'll become a huge part of your site-building toolkit.)

The beauty of @INHERIT comes in when you have a lot of sections of your site that needs similar content. Like the sidebar on our site. While that doesn't seem like a big deal at first blush, it really adds up over the long haul.

The old template had three separate TVs with three separate chunks. Now, we just put one simple little "@INHERIT {{sidebar}}", and it takes care of the entire site and every template. If we need to change the sidebar, we just change it at the root folder for that section and it automagically populates down to the children below it. Simple, elegant, and cool. (And it actually even keeps the DB bulk down over time too, so it should be faster in theory as well.) One note from Adam, @INHERIT's creator, though: use it in conjunction with cached pages for optimal performance.

Up next: building of the MODx blog and more "ahah!" moments with dynamically generated CSS that's oh-so-easy thanks again to MODx.