Shortcodes is a port of the WordPress shortcodes implementation to CFML.  Shortcodes are simple inline directives you can place in your content (typically in some sort of web-based editor that is stored in a database), and then process at runtime when emitting the content for consumption.  It's a very nice way to mix a controlled amount of programmability into content, without requiring authors to learn a programming language or give them wholesale access to your server environment.  Since you control the shortcodes, you can manage every aspect of what authors can and cannot do with code.

For example, if you support a 'latex' shortcode a content author might create this piece of content:

<p>I use [latex block=false]\LaTeX[/latex] for formulas.

When you run it through the shortcode implementation, it might turn into this markup:

<p>I use <img src="" alt="\LaTeX" title="\LaTeX" class="latex" /> for formulas.

The author doesn't need to know anything about the WordPress \LaTeX service, IMG tags, etc., and you (the admin) can control the classes (and thence styling) the IMG is emitted with as well.  But they still get a nice \LaTeX graphic:

I use \LaTeX for formulas.

Obviously shortcodes has nothing to do with \LaTeX specifically; shortcodes is just a DSL for content-inlined code execution.

This is simplistic demo, but there is a more complete demo available online, and the source is available in Subversion.

  • Version 1.1: 2011-01-21 post
  • Version 1: 2010-03-13 post