Errata Page for MODX: The Official Guide

This page contains updates and corrections for my book, MODX: The Official Guide. Since we are able to update the book as we go, your copy may not contain all of the following errors.


Page Correction
103 ff.In later version of Revolution, "View Resource" has been changed to "Resource Overview" and "Preview Resource" has been changed to "View"
103The last four items on the list are not subitems under Create, but separate list items at the same level as Create.
87The PHP path for the Mac is incorrect, it should be: /Applications/xampp/xamppfiles/bin/php transport.core.php
108The third entry in the first permission list should be "4 — read", not "3 — read".
201In the next-to-last paragraph, 'right-click on the "Vehicle" document' should be 'right-click on the "Inventory" document'
233-234The "Yes/No" conditional modifiers are incorrect. They should be in this form: [[<i>*field</i>:if=`1`:then=`Yes`:else=`No`]] ("then=" is missing)
256 ff.Reuse of $resource variable (See note below)
259In the first tag example, [[$PropertyDemo@MyFirstPropertySet]] should be [[$PropChunk@MyFirstPropertySet]]
271The code [[SnippetName? &varName=`[[~[[12]]]]` ]] should be [[SnippetName? &varName=`[[~12]]` ]]
281In the first code line of the YesNo snippet, "If" should be in all lowercase letters.
325Missing "<" — '/p>' should be '</p>'
327Some hyphens are not visible — $resource>get should be $resource->get and $chunk>get should be $chunk->get.
400Some hyphens are not visible — $chunk>setContent() should be $chunk->setContent() and $chunk>save() should be $chunk->save().
400Extra parentheses — </head>)\n should be </head>\n.
400Missing left bracket — [*content]] should be [[*content]].
478Register snippet should be called uncached: [[!Register ... ]].
503The permission clear_cache should be empty_cache in later versions of Revolution.
503 ff.The button for leaving an editing panel has the caption "Close" rather than "Cancel" in later versions of MODX Revolution
511Last line of the first set of instructions. Remove "Next click on the" at the end of the line.
528-531Due to a printing error the closing HTML comment tags are shown with a single dash (->). They should have two dashes (-->).
536To get cURL (and Package Manager) working on localhost with XAMPP, you may also have to modify your firewall and add an exception for the C:\xampp\php\ext\php_curl.dll file.
696The command just above the table should be "Go to System -> System Settings", not "Go to Create -> Create a Document Here

General Notes

Newer versions of MODX don't like it when you reuse variables that point to MODX objects. The only examples of this I know of in the book are in the ObjectDemo snippet starting on p. 256, where the $resource variable is set to the current resource, then reset later with $modx->getObject(). The getObject() call fails resulting in an error. The fix is to either use a new variable name from that point on (e.g. $newResource), or delete (or comment out) the code above that point. There may be more cases of this in the ObjectDemo snippet examples. Always use a new variable name if you are referring to another resource, user, or other MODX object.

The tree_default_sort System Setting controls sorting of the Resource tree.

The name of the "Preview" option in the Manager has been changed to "View". It appears on the right click menu in the Resource tree and as a button on the Create/Edit Resource panel. New resources must be saved before the "View" option will appear.

The makeUrl() method should always use the "full" option: $myUrl = $modx->makeUrl('12', "", "", "full");

Wayfinder tags should generally be called cached once you are through developing the Wayfinder menu: [[Wayfinder . . . ]]

You can significantly speed up getResources by using the new properties to tell it which TVs to get and which TVs to process:

    &processTVs=`1` // not necessary if you can use the raw content of all TVs
    &includeTVList=`tv1,tv2,tv3` // only includes these TVs
    &processTVList=`tv2` // only process tv2 (must be in includeTVList if specified)
    &tvPrefix=``   // or whatever


If you leave out the &parents property for getResources, it will assume the current resource is the parent. If you truly ONLY want the Resources listed in the &resources property, set &parents to -1 and it will be ignored.

The Login package now includes an ActiveUsers snippet that will show a list of user currently logged in to the front end (no documentation yet for ActiveUsers that I'm aware of).

The getCache snippet can be used to "wrap" another snippet and control how long its results will be cached. There is an example here

The fast way to set the value of a TV for a particular resource in code using the modTemplateVarTemplate object:

    $valueToSet = 'Some Value';
    $resourceId = 12;
    $tvId = 22;

    $tvr = $modx->newObject('modTemplateVarResource');
    $tvr->set('contentid', $resourceId);
    $tvr->set('tmplvarid', $tvId);
    $tvr->set('value', $valueToSet);

As of MODX 2.1.4, there is a comment tag that will be ignored by MODX and removed when the page is rendered. Note that the comment tag will still be present for any plugins attached to the OnParseDocument event, which may see it as a legitimate MODX tag.

    [[-This is a comment, MODX will ignore it]]

As of MODX 2.2, it is possible to store the content of MODX elements and resources somewhere other than the MODX database. This allows you to use version control on the objects. Possible storage locations include files on the server, Amazon S3 bucket, DropBox, etc. The objects will be parsed and rendered exactly as they were when in the DB. See the following links for more information:

Media Sources

Static Resources

Static Elements

All filemanager_* settings and base_path/base_url TV input options are deprecated as of MODX 2.2. They are ignored by the Manager and replaced by Media Sources. Snippets and plugins in the book that use the file_manager_path setting will still work to control user access in the front end, but will have no effect on how the tree is rendered in the Manager. To control the rendering of the tree for specific users, see the information here

If you deny access to a page with a snippet in the template, make sure you don’t do that in the template of the page you forward to (e.g., error or unauthorized page) or the template of the Login page!

In all examples in the book where a new document is created with $modx->newObject('modResource'), the type of object should be modDocument, not modResource. The modResource class is an abstract class that can be used in searches with get*() functions, but should never be used to create a new object.

The Articles package now provides a complete blogging solution for MODX Revolution.

TinyMCE version 4.3.1 requires MODX 2.2.0 or newer.

You cannot use InnoDB tables for MODX at the current time, at least not for the site_content table. MODX requires a fulltext index on that table at this time, which is not supported by that storage engine.

As of MODX 2.1, the use_friendly_aliases setting is no longer used. If you enable friendly_urls, you are automatically using friendly aliases in MODX 2.1+.

Creating a new resource in code is now more properly done using the resource/create processor. The method shown in the book will still work, but the processor does a better job of handling default values for the fields:

    $title = 'MyPage';
    $pageAlias = 'my-page';
    $templateId = 2;

    $fields = array(
      'pagetitle' => $title,
      'template' => $templateId,
      'alias' => $pageAlias,
      /* other fields here as necessary. System defaults will be used if empty */

    /* create and save new resource */
    $response = $this->modx->runProcessor('resource/create', $fields);

    /* optional error handling */

    if ($response->isError()) {
        if ($response->hasFieldErrors()) {
            $fieldErrors = $response->getAllErrors();
            $errorMessage = implode("\n", $fieldErrors);
        } else {
            $errorMessage = 'An error occurred: ' . $response->getMessage();

        return $errorMessage;

    } else {
        /* optional - in case you want the ID of the new resource (e.g., for makeUrl() ) */
        $object = $response->getObject();

        $resourceId = $object['id'];



The "Home" Top Menu option is called "Dashboard" in later versions of MODX Revolution.


Report More Errors in the Book

If you find errors in the book that are not listed on this page, please report them here


Thank you for visiting

  —  Bob Ray