API:evalSnippet
From MODx Wiki
API Function Definition:
evalSnippet
- Versions
- > 0.9.2
- Return Values
- Success: Output of a given snippet
- Fail: empty string (or false?)
- Data Type
- string
- Object Hierarchy
- DocumentParser
string evalSnippet(string $snippet [, array $params]);
Executes the snippet code contained in $snippet. For running a snippet by calling its name, see runSnippet
Examples
Related Functions
Function Source
| File: | manager/includes/document.parser.class.inc.php |
|---|---|
| Line: | 761 |
function evalSnippet($snippet, $params) { $etomite = $modx = &$this; $modx->event->params = & $params; // store params inside event object } // log error $this->logEvent(1, 3, "<b>$php_errormsg</b><br /><br /> $msg", $this->currentSnippet . " - Snippet"); if ($this->isBackend()) $this->Event->alert("An error occurred while loading. Please see the event log for more information<p />$msg"); } } return $msg . $snip; }