summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorSean Coates <sean@caedmon.net>2006-02-24 16:56:31 +0100
committerSean Coates <sean@caedmon.net>2006-02-24 16:56:31 +0100
commit31e187f85698a8f8dfbf4705761517c05cd6aab6 (patch)
treecba4b58ec9f8a758a3ca446555910595b4c883ea /inc
parent4fced885b8367f95114c6ecbc12ff49b79498999 (diff)
downloadrpg-31e187f85698a8f8dfbf4705761517c05cd6aab6.tar.gz
rpg-31e187f85698a8f8dfbf4705761517c05cd6aab6.tar.bz2
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
Diffstat (limited to 'inc')
-rw-r--r--inc/lang/en/lang.php1
-rw-r--r--inc/template.php29
2 files changed, 22 insertions, 8 deletions
diff --git a/inc/lang/en/lang.php b/inc/lang/en/lang.php
index f3c7c3dbe..1a4308125 100644
--- a/inc/lang/en/lang.php
+++ b/inc/lang/en/lang.php
@@ -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';
diff --git a/inc/template.php b/inc/template.php
index 63e90118d..5d085605d 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -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"');