$myChunk = 'testMenu'; // your chunk name
$params['startId'] = '0';
$params['level'] = '4';
$html = addslashes($modx->runSnippet('Wayfinder', $params));
$sql= "UPDATE " . $modx->getFullTableName("site_htmlsnippets") . " SET snippet='$html' WHERE name='$myChunk'";
<?php
$params['startId'] = '0';
$params['level'] = '4';
$html = addslashes($modx->runSnippet('Wayfinder', $params));
$chunk = $modx->getObject('modChunk', array('name' => 'testMenu'));
if ($chunk) {
$chunk->setContent($html);
$chunk->save();
}
$html = addslashes($modx->runSnippet('Wayfinder', $params));
<?php
$params['startId'] = '0';
$params['level'] = '3';
$modx->runSnippet('Wayfinder'), $params);
Beside this I am meanwhile not convinced if this plugin will really help us because in our case the menu has to be a little different on every page because the menu-item which is opened should be marked like it is done in wayfinder automatically for each site...That’s true, it’s not going to help you at all if it needs to be different on every page.
How slow is your menu loading? Are you calling it cached?
I think we would need a own chunk with the menu in it for every page. All these chunks have to be updated on saving / creating a new resource. I think such automatically created chunks shouldn´t be too difficult to implement but at the moment I am not sure how to realize this.
Beside this I am meanwhile not convinced if this plugin will really help us because in our case the menu has to be a little different on every page because the menu-item which is opened should be marked like it is done in wayfinder automatically for each site...That’s true, it’s not going to help you at all if it needs to be different on every page.