My first few MODx projects were a mess. I spent too much time trying to remember chunk or TV names and often forgot how they were categorized. Since then, I’ve come up with some naming conventions that have helped me keep my projects better organized.

Template Variables (TVs)

Most TVs can be boiled down to four basic types: image, link, text and standard field. Image and link types are self-explanatory. The text type is for a TV whose input is more than one line—essentially anything requires more than a few words. Standard field is for a one-line input, such as a short header. I use the conventions like this:

  • Image = img_descriptor
  • Link = anc_descriptor
  • Text = txt_descriptor
  • Standard Field = stf_descriptor

Chunks

The amount of chunks in a large MODx site can get out of hand pretty quickly. Here’s how I usually group my chunks.

“Includes” – Chunks that would normally be includes when building a non-CMS driven site, like the header, footer, etc. Example: inc_header

“Tpls” – Chunks that are used by snippets. Example: tpl_descriptor

“Conditionals” – Chunks that are conditionally based, usually associated with the If snippet. Example: if_descriptor

“Forms” = Chunks that are specific to forms. Example: form_descriptor

Categories

I still struggle with how to categorize my TVs and Chunks, but some of the category names that have worked for me are:

  • Conditional Chunks
  • Forms
  • Template Includes
  • Tpls

The beauty of MODx lies in its flexibility. Without developing some sort of standards that work for you, that flexibility can easily lead to a frustrating build.

Field Guide

Google