OnWebPagePrerender
Event: OnWebPagePrerender
Fired after a Resource is parsed, but before it is rendered.
Content Type headers have not yet been sent, nor has the output been flushed.
Service: 5 - Template Service Events Group: None
Event Parameters
None.
Example
Description: Filter words from a document before it's displayed on the web System Events: OnWebPagePrerender
$words = array("snippet", "template"); // words to filter
$output = &$modx->resource->_output; // get a reference to the output
$output = str_replace($words,"<b>[filtered]</b>",$output);
Be careful if your OnWebPagePrerender plugin is a static element and it includes or requires files using relative paths. The plugin code executes from its cached file, e.g. core/cache/includes/elements/modplugin/7.include.cache.php
, not from the original static element file. See Bug 11129