MODX Revolution Tags

MODX tags have a slightly different style in MODX Revolution. All tags now start with [[ and end with ]]. This makes the document parser faster and more efficient since the complex code used to identify the old-style tags is gone. Once you get used to the new tag format, you'll find that it's easier and less likely to lead to entry errors.

Here's a list of the tag changes:

MODX Tags

OldNew
Resource Tags
[*ResourceField/TV*] [[*ResourceField/TV]]
Chunk Tags
{{Chunk}} [[$Chunk]]
Snippet Tags
[[Snippet]] [[Snippet]]
Placeholder Tags
[+Placeholder+] [[+Placeholder]]
Link Tags
[~ResourceId~] [[~ResourceId]]
Setting Tags
[(system_setting)] [[++SettingName]]
Language Tags
No Tag [[%LanguageStringKey]]
Comment Tags (2.1.4+)
No Tag [[-comment]]

 

Cache Control

OldNew
[!Snippet!] [[!Snippet]]
No Tag [[!$Chunk]]
No Tag [[!*ResourceField/TV]

 

As of MODX 2.1.4, you can disable any tag by putting a minus sign immediately after the opening square brackets. This form can also be used for comments in the page content that are not intended to be shown on the rendered page. The tag will be ignored and removed from the output:


[[-SnippetName? &argumentName=`value`]]
[[-This Is a Comment]]

With language tags, you have the option of specifying the language, namespace, and topic using properties in the tag:

    
[[%LanguageStringKey? &language=`en` &namespace=`NameSpaceName` &topic=`TopicName`]]

Note that in Revolution, you can put arguments in the URL for use with $_GET by simply adding them to a link tag:

    
[[~12? &argumentName=`value`]]
    

Revolution will work out the appropriate form.

 

My book, MODX: The Official Guide - Digital Edition is now available here. The paper version of the book is available from Amazon.

If you have the book and would like to download the code, you can find it here.

If you have the book and would like to see the updates and corrections page, you can find it here.

MODX: The Official Guide is 772 pages long and goes far beyond this web site in explaining beginning and advanced MODX techniques. It includes detailed information on:

  • Installing MODX
  • How MODX Works
  • Working with MODX resources and Elements
  • Using Git with MODX
  • Using common MODX add-on components like SPForm, Login, getResources, and FormIt
  • MODX security Permissions
  • Customizing the MODX Manager
  • Using Form Customization
  • Creating Transport Packages
  • MODX and xPDO object methods
  • MODX System Events
  • Using PHP with MODX

Go here for more information about the book.

Thank you for visiting BobsGuides.com

  —  Bob Ray