Skip to content

Instantly share code, notes, and snippets.

@Codenator81
Last active August 29, 2015 14:02
Show Gist options
  • Save Codenator81/3ec9e6a80d53346b3207 to your computer and use it in GitHub Desktop.
Save Codenator81/3ec9e6a80d53346b3207 to your computer and use it in GitHub Desktop.
testClass
// class
<?php
global $modx;
class Webdev extends xPDOSimpleObject {
function __construct(modX &$modx) {
$this->modx =& $modx;
}
function runAsFunction($name,$params = []){
global $modx;
if($s = $modx->getObject('modSnippet', [
'name' => $name,
])){
$s->loadScript();
$f = $s->getScriptName();
// $params = array('foo' => $foo);
$func = $f($params);
return $func;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment