I couldn’t get the PageTrail snippet to work for me as included in the latest distribution. Updating the API calls to more current ones seems to fix it. Here’s what works for me (in case anyone else needs it):
$sep = isset($sep) ? $sep :" » ";
$style = isset($style) ? " style=\"$style\" " :"";
$class = isset($class) ? " class=\"$class\" " :"";
// end config
$docInfo = $modx->getDocument($modx->documentIdentifier);
$ptarr = array();
$pid = $docInfo['parent'];
$ptarr[] = "<a $class $style href='[~".$docInfo['id']."~]'>".$docInfo['pagetitle']."</a>";
while ($parent=$modx->getDocument($pid)) {
$ptarr[] = "<a $class $style href='[~".$parent['id']."~]'>".$parent['pagetitle']."</a>";
$pid = $parent['parent'];
}
$ptarr = array_reverse($ptarr);
return join($ptarr, $sep);
-
MODX Staff
- 12,272 Posts
Why not post that as a new release or an extra in the repository?
Ryan Thrash, MODX Co-Founder
Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
I’m not sure how to do that, but if I do it should include the original credits (since I didn’t really do anything except change a few API calls).
Does this snippet not functioning anymore indicate that a recent change has broken some of the backwards-compatibility in previous versions?
Or maybe I’m the only one who had trouble with this...