Loading the MODx Object
Using the MODx object (and all of its respective classes) is quite simple. All you need is this code:
require_once '/absolute/path/to/modx/config.core.php';
require_once MODX_CORE_PATH.'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('web');
$modx->getService('error','error.modError');
This will initialize the MODx object into the 'web' Context. Now, if you want to access it under a different context (and thereby changing its access permissions, policies, etc), you'll just need to change 'web' to whatever Context you want to load. This also loads the MODX error handler as well.
From there, you can use any MODx methods, functions, or classes.
See Also
- Developer Introduction
- xPDO, the db-layer for Revolution