So I’m out of ideas. We have a header that is using a Wayfinder snippet for the navigation. Works beautifully on the site. But Wayfinder isn’t processed and cached at the save point, it’s processed at runtime.
That’s all fine, but we have an external site that we want to use that same header on. I thought, okay, no big deal. I’ll just process the modChunk object for the header and output it to an html file. This works for everything but Wayfinder. I can’t figure out what I need to give Wayfinder.
So here’s my Header Export Plugin:
$eventName = $modx->event->name;
if ($eventName == 'OnChunkFormSave') {
if (isset($modx->event->params['chunk']) && $modx->event->params['chunk']->name == 'header') {
//hack to force resource to have a value
$modx->resource = $modx->getObject('modResource', array('alias'=>'blog'));
$output = $modx->parseChunk('header', array());
file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/header.html', $output);
}
}
My header has this Wayfinder snippet:
<div id="nav">
[[Wayfinder? &startId=`0` &level=`3` &parentRowTpl=`cssplay_revParentRow` &cssTpl=`cssplay_ultdrop` &excludeDocs=``]]
</div>
Admittedly, I’m not really an expert in modX. I’m comfortable and generally know my way around, but I can’t figure this one out.
This project is php 5.3, modx 2.0.5 (I can usually translate any 2.1/2.2 code down, so whatever you can suggest is cool.)
Any thoughts froms
yous guys?