Hi,
I would like to set the parent of current document as Wayfinder root (i.e. startId).
Excepted in the case where the parent’s id equals to 1.
In such case, the current document should be kept as root for Wayfinder.
In Wayfinder configuration file, I put this code.
$startId="@CODE:
$startId = $modx->getParent(-1,0,'id');
$startId = $startId['id'];
if ($startId == 1) {
$startId = $modx->getPageInfo(-1, 1, 'id');
$startId = $startId['id'];
}
return $startId;
";
Unfortunately it fails and I get this error when trying to display the document:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE,
expecting T_STRING or T_VARIABLE or T_NUM_STRING in D:\xampplite\htdocs\some_site\assets\snippets\wayfinder\configs\menu_rubriques.config.php on line 5
Line 5 is the third line in my code, where I’m trying to retrieve the id of the parent from the array : $startId = $startId[’id’];
Who can help ?
Thanks a lot.