I've been trying to do this with Wayfinder, but it isn't working. It's failing by just failing and not processing anything else. I suspect what's happening is Wayfinder is trying to return a value that isn't set. I was trying to trace that through Wyafinder but it is veery difficult and time-consuming and I was wondering if anyone knew.
This is basically the ode (but I'm removed my attempt at tracing through Wayfinder).
<?php
define('MODX_API_MODE',true);
define('MODX_DOCUMENT_IDENTIFIER', 49);
require_once '[PATH HERE]/config.core.php';
require_once MODX_CORE_PATH.'model/modx/modx.class.php';
$modx = new modX();
$modx->documentIdentifier = 49;
$modx->initialize('web');
$modx->getService('error', 'error.modError');
$test = $modx->getObject('modResource',49);
$modx->resource = $test;
$output = $modx->runSnippet('Wayfinder',array( 'startId' => 1,'debug'=> true));
print $output;
I can run chunks that don't have snippets that need whatever variable it is that isn't set. But I can't do Wayfinder. Is there a way to initialize modX as if I were a modX page in some more complate way than setting the document identifier or $modx->resource?