Hi folks, it’s my first post here so if it’s in the wrong place please feel free to flame
I’m having a problem with a snippet i’ve written which returns the parent page title or the current page title using the isfolder variable. The code is written as follows...
<?php
$docId = $modx->documentIdentifier;
if ($isFolder == 0) {
$parent = $modx->getParent($docId, 1, 'pagetitle');
return $parent['pagetitle'];
exit;
}
if ($isFolder == 1) {
$parent = $modx->getPageInfo($docId, 1, 'pagetitle');
return $parent['pagetitle'];
exit;
}
?>
I’m calling the snippet as follows...
[[parentTitle?&isFolder=`[*isfolder*]`]]
The above works fine in a page template but falls over when used in a chunk, returning the pagetitle if the page is a page and returning nothing if the page is a folder
Can anyone tell me what i’m doing wrong? I’d like to be able to use the code in the chunk as it’s used on every page except my homepage and if i feel like redesigning my site it would make it much easier to update just the chunk instead of a few templates.
Cheers
[Edit]
Sorry, forgot to mention my setup!
Modx Version: 0.9.6
Server: Apache 2.0.54
PHP Version: 5.23.
Not sure of the mysql version, sorry.