Hello,
I’am trying to use the MODx API to get my MODx menu into an external PHP application.
The snippet call in my MODx site is the following :
[[Wayfinder?startId=`0` &outerTpl=`mh.OuterTpl` &innerTpl=`mh.InnerTpl` &rowTpl=`mh.RowTpl` &innerRowTpl=`mh.InnerRowTpl` &firstClass=`first` &hereClass=``]]
The code I tried in my external application :
<?php
include_once(realpath("../modxapi.php"));
$modx = new MODxAPI();
$modx->connect();
$modx->getSettings();
$chunk1 = $modx->getChunk('mh.OuterTpl');
$chunk2 = $modx->getChunk('mh.InnerTpl');
$chunk3 = $modx->getChunk('mh.RowTpl');
$chunk4 = $modx->getChunk('mh.InnerRowTpl');
$modxmenu = $modx->runSnippet('Wayfinder', array('startId' => '0', 'outerTpl' => $chunk1, 'innerTpl' => $chunk2, 'rowTpl' => $chunk3, 'innerRowTpl' => $chunk4, 'firstClass' => 'first', 'hereClass' => ''));
?>
The menu is generated, but without taking care of the different chunk mh.OuterTpl, mh.InnerTpl, etc.
Does anyone know what’s wrong with that code ?