<?php if (!defined('PmWiki')) exit(); /* Copyright 2005 Patrick R. Michaud (pmichaud@pobox.com) This file is trailmenu.php; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See pmwiki.php for full details. */ SDV($FPLFunctions['trailmenu'], 'FPLTrailMenu'); function FPLTrailMenu($pagename, &$matches, $opt) { global $FPLTrailMenuOpt, $PCache; SDVA($FPLTrailMenuOpt, array('readf' => 0)); $matches = MakePageList($pagename, array_merge($FPLTrailMenuOpt,(array)$opt)); $pl = array($pagename); while (count($pl)>0) { $p = array_shift($pl); @$ancestors[$p]++; foreach((array)@$PCache[$p]['parentnames'] as $pa) if (!$ancestors[$pn]) $pl[] = $pa; } @$ancestors['']++; $out = array(); foreach($matches as $pc) { foreach($pc['parentnames'] as $pa) if ($ancestors[$pa]) { $out[] = str_repeat('*', $pc['depth']) . " {$pc['markup']}\n"; continue 2; } } return implode('', $out); }