Displaying placeholders and snippet calls
This is the plugin Brackify, which i use to display placeholders, snippet calls etc in the examples in the Ditto section. If you have [+placeholder+] as normal in your text, the element will be parsed by MODx. Entering a space between the bracket and the plus sign or other punctuation, thus: [ +placeholder+ ], avoids parsing, and the space is removed by the plugin when the page is output.
-
$e = &$modx->Event;
-
if ($e->name == "OnWebPagePrerender"){
-
$page = $modx->documentOutput;
-
$brackets = '[ (,) ],[ [,] ],[ !,! ],[ +,+ ],[ *,* ]' ;
-
$modx->documentOutput = $page;
-
}
You could usefully add double curly braces to the list in line 4 to cater for chunks. Line 9 substitutes [(base_path)] for the actual path to my WWW directory on the server, restoring what was in the original code and hiding my server account information.
Note there's no <?php and ?> pair in a plugin. Also that OnWebPagePrerender has to be checked in the System Events tab.