Some interesting results!
I inserted the following code as a VB plugin (VB does this with eval, I believe) and got some mixed output:
The wayfinder snippets did not execute, but the chunk was called successfully. We’ve seen this behaviour before, but what I didn’t notice last time was that a nested "UltimateParent" snippet DID execute.
I changed the calls so that they were cached, and they executed, but not the UP one although this time it looked like a parsing error. So, just randomly, I changed that to uncacheable and the whole thing worked. Amazing.
Here’s the problem. The main ModX hosted site went blank, completely blank. No returned html or anything. The code also messed around with some database calls that followed in VB and a gallery that runs there too, on the same page.
So, very good progress, thank you all, but some niggles which make this unusable at the moment. It looks as if ModX is being upset by foreign calls (the forums and site are on different subdomains... does this affect things?), and from what I can tell, bad encapsulation of database usage is causing them all to mess around with each other.
<?php
// I had to make this direct, as they are on different subdomains
define('MODX_BASE_PATH', '/home/xxx/subdomains/pages/');
define("IN_PARSER_MODE", "true");
define("IN_MANAGER_MODE", "false");
if (!defined('MODX_API_MODE')) {
define('MODX_API_MODE', true);
}
// initialize the variables prior to grabbing the config file
$GLOBALS['database_type'] = 'mysql';
$GLOBALS['database_server'] = 'localhost';
$GLOBALS['database_user'] = 'username';
$GLOBALS['database_password'] = 'password';
$GLOBALS['dbase'] = 'database';
$GLOBALS['table_prefix'] = 'modx_';
$GLOBALS['base_url'] = 'http://pages.bfenthusiasts.com/';
$GLOBALS['base_path'] = '/home/xxx/subdomains/pages/';
define('MODX_BASE_URL', $GLOBALS['base_url']);
define('MODX_SITE_URL', $GLOBALS['base_url']);
$ipath = ini_get('include_path');
ini_set('include_path', $ipath . ':' . $GLOBALS['base_path']);
// initiate a new document parser
include_once($GLOBALS['base_path'].'manager/includes/document.parser.class.inc.php');
$GLOBALS['modx'] = new DocumentParser;
$modx =& $GLOBALS['modx'];
$etomite = &$GLOBALS['modx']; // for backward compatibility
// set some parser options
$modx->minParserPasses = 1; // min number of parser recursive loops or passes
$modx->maxParserPasses = 10; // max number of parser recursive loops or passes
$modx->dumpSQL = false;
$modx->dumpSnippets = false;
$modx->tstart = $tstart; // feed the parser the execution start time
$modx->getSettings();
$modx->documentMethod = 'id';
$modx->documentIdentifier = 71;
// header
$modx_navcanvas = $modx->rewriteUrls($modx->parseDocumentSource('{{NavigationCanvas}}'));