Created
April 19, 2012 19:38
-
-
Save chucktrukk/2423607 to your computer and use it in GitHub Desktop.
Load and instantiate MODxAPi from a directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if( !isset($modx) ) { | |
/*Test the realpath by just starting with /../ and keep adding till you get where you're going*/ | |
$modx_base_path = realpath(dirname(__FILE__) . '/../../../../../'); | |
define('MODX_BASE_PATH', $modx_base_path.'/' ); | |
$old_dir = getcwd(); | |
chdir(MODX_BASE_PATH); | |
require MODX_BASE_PATH . 'manager/includes/config.inc.php'; | |
require MODX_BASE_PATH . 'manager/includes/document.parser.class.inc.php'; | |
require MODX_BASE_PATH . 'MODxAPI.class.php'; | |
$modx = new MODxAPI; | |
$modx->connect(); | |
chdir($old_dir); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment