Skip to content
Snippets Groups Projects
Commit 31e187f8 authored by Sean Coates's avatar Sean Coates
Browse files

hierarchical breadcrumbs

This patch adds optional hierarchical breadcrumbs. This was discussed last
december in http://www.freelists.org/archives/dokuwiki/12-2005/msg00112.html
and followups. Many people where in favour of this.

darcs-hash:20060224155631-21b7e-10f25b7bdf60120ec99850afefd4d1662c5b87aa.gz
parent 4fced885
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,7 @@ $conf['template'] = 'default'; //see tpl directory
$conf['fullpath'] = 0; //show full path of the document or relative to datadir only? 0|1
$conf['recent'] = 20; //how many entries to show in recent
$conf['breadcrumbs'] = 10; //how many recent visited pages to show
$conf['youarehere'] = 0; //show "You are here" navigation? 0|1
$conf['typography'] = 1; //convert quotes, dashes and stuff to typographic equivalents? 0|1
$conf['htmlok'] = 0; //may raw HTML be embedded? This may break layout and XHTML validity 0|1
$conf['phpok'] = 0; //may PHP code be embedded? Never do this on the internet! 0|1
......
......@@ -111,6 +111,7 @@ $lang['yours'] = 'Your Version';
$lang['diff'] = 'show differences to current version';
$lang['line'] = 'Line';
$lang['breadcrumb'] = 'Trace';
$lang['youarehere'] = 'You are here';
$lang['lastmod'] = 'Last modified';
$lang['by'] = 'by';
$lang['deleted'] = 'removed';
......
......@@ -535,12 +535,12 @@ function tpl_breadcrumbs(){
/**
* Hierarchical breadcrumbs
*
* This code was suggested as replacement for the usual breadcrumbs
* trail in the Wiki and was modified by me.
* This code was suggested as replacement for the usual breadcrumbs.
* It only makes sense with a deep site structure.
*
* @author Andreas Gohr <andi@splitbrain.org>
* @author Nigel McNie <oracle.shinoda@gmail.com>
* @author Sean Coates <sean@caedmon.net>
* @link http://wiki.splitbrain.org/wiki:tipsandtricks:hierarchicalbreadcrumbs
* @todo May behave strangely in RTL languages
*/
......@@ -549,16 +549,22 @@ function tpl_youarehere(){
global $ID;
global $lang;
//check if enabled
if(!$conf['youarehere']) return;
$parts = explode(':', $ID);
// Perhaps a $lang['tree'] could be defined? "Trace" isn't too appropriate
//print $lang['tree'].': ';
print $lang['breadcrumb'].': ';
print $lang['youarehere'].': ';
//always print the startpage
if( $a_part[0] != $conf['start'] )
tpl_link(wl($conf['start']),$conf['start'],'title="'.$conf['start'].'"');
if( $a_part[0] != $conf['start']){
if($conf['useheading']){
$pageName = p_get_first_heading($conf['start']);
}else{
$pageName = $conf['start'];
}
tpl_link(wl($conf['start']),$pageName,'title="'.$pageName.'"');
}
$page = '';
foreach ($parts as $part){
......@@ -569,7 +575,14 @@ function tpl_youarehere(){
$page .= $part;
if(file_exists(wikiFN($page))){
tpl_link(wl($page),$part,'title="'.$page.'"');
if($conf['useheading']){
$pageName = p_get_first_heading($page);
$partName = $pageName;
}else{
$pageName = $page;
$partName = $part;
}
tpl_link(wl($page),$partName,'title="'.$pageName.'"');
}else{
// Print the link, but mark as not-existing, as for other non-existing links
tpl_link(wl($page),$part,'title="'.$page.'" class="wikilink2"');
......
......@@ -64,6 +64,12 @@
</div>
<?php }?>
<?php if($conf['youarehere']){?>
<div class="breadcrumbs">
<?php tpl_youarehere() ?>
</div>
<?php }?>
</div>
<?php flush()?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment