00001 <?php
00002 function breadcrumbs_box($location, $tpl_vars) {
00003 global $CONTENT_DIR;
00004
00005 $depth = count($location['data']);
00006
00007 $pages = page_list($CONTENT_DIR);
00008 if ($depth == 0) {
00009 $location['data'][0] = $pages[0];
00010 $depth = 1;
00011 }
00012
00013 $base_url = $tpl_vars['self'] . '/page:';
00014 $output = "<ul>\n";
00015 for ($i = 0; $i < $depth; $i++) {
00016 $path = join(':', array_slice($location['data'], 0, $i + 1));
00017 $label = $location['data'][$i];
00018 $output .= sprintf('<li><a href="%s">%s</a></li>',
00019 $base_url . $path, $label);
00020 }
00021 $output .= "</ul>\n";
00022 return $output;
00023 }
00024 $BOXES[] = 'breadcrumbs';
00025 ?>