modX.runSnippet

Skip to end of metadata
Go to start of metadata


modX::runSnippet

Process and return the output from a PHP snippet by name.

Syntax

API Doc: http://api.modxcms.com/modx/modX.html#runSnippet

string runSnippet (string $snippetName, [array $params = array ()])

Example

Run the 'Welcome' snippet with some custom parameters:

$output = $modx->runSnippet('Welcome',array(
   'name' => 'John'
));
echo $output; // prints 'Welcome John!'

See Also

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.