We here at Zoom Creates love giving people the option to maintain their own websites once we are done building them. One of our favorite CMS platforms is MODx. It’s based on PHP, is open source, and is extremely flexible. Today I’m going to talk to you about the basics of building a HTML based template.
Let’s start with a basic HTML page:
<h1>Page Header</h1> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
MODx doesn’t store your site content in text files on the server. Like most CMS platforms, your website’s content is stored in a database. Since most of the pages on a typical website look the same, we can take some HTML and use it as a template. If we use that HTML code above as our template, we just need to remove the two paragraphs above and put that copy into different pages. The template would now look like this:
<h1>[*pagetitle*]</h1> [*content*]
Now, when you create a new page, the page title will automatically be wrapped into h1 tags, and the page content will follow. Those things above in the square brackets are MODx tags. These will automatically take information from the database and populate the website with the markup from your template. Pretty cool, eh?
There are a LOT of tags that you can use. You can even build custom php functions (called snippets by MODx) and include those into your template. You can also build template variables, so that each page that you create has more than one content box. This is useful when you have a two column layout (or sidebar content) and you want it to vary between pages. If you want to have one piece of static HTML that goes across your entire site, you can build a chunk. Then calling that chunk’s name in your page content or template will display that HTML.
I hope that I’ve shown you just how flexable MODx is, even though I’ve only shown you a very, very simple example. I encourage you to check out the MODx wiki, especially the Beginner’s Guide to MODx. That page will show you just how many options there are for a simple theme. Thanks for reading!



