MODX: speed up wayfinder calls
http://forums.modx.com/thread/39979/wayfinder-slowness-issue?page=3#dis-post-413494
developed by Lucas
Idea: Speed up wf by creating a static wayfinder chunk every time a document is saved. (should slow down manager).
a) create a chunk. Leave it empty. Name it whatever you want, e.g. testMenu
b) create a plugin. Enter this:
$myChunk = 'testMenu';
$params['startId'] = '0';
$params['level'] = '4';
// additional Wayfinder params here
$html = $modx->runSnippet('Wayfinder', $params);
$chunk = $modx->getObject('modChunk', array('name' => $myChunk));
if (!empty($chunk)) {
$chunk->set('snippet' => $html);
$chunk->save();
}
c) Check the system event OnDocFormSave + save the plugin.
d) Change your template: Replace your Wayfinder call with your chunk:
[[$testMenu]]