Skip to content

Commit

Permalink
fix for breadcrumbs and "namespace:start" pages (FS#927) by Nathan Fr…
Browse files Browse the repository at this point in the history
…itz <fritzn@crown.edu>

darcs-hash:20070331213401-d5083-2c30028ab1c81465b0295106ce6a52ce18ad87cf.gz
  • Loading branch information
selfthinker committed Mar 31, 2007
1 parent 671a58a commit 1a84a0f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion inc/common.php
Expand Up @@ -236,7 +236,7 @@ function breadcrumbs(){
}

// page names
$name = noNS($ID);
$name = noNSorNS($ID);
if ($conf['useheading']) {
// get page title
$title = p_get_first_heading($ID);
Expand Down
29 changes: 28 additions & 1 deletion inc/pageutils.php
Expand Up @@ -98,7 +98,7 @@ function cleanID($raw_id,$ascii=false){
// check if it's already in the memory cache
if (isset($cache[$raw_id])) {
return $cache[$raw_id];
}
}

$sepchar = $conf['sepchar'];
if($sepcharpat == null) // build string only once to save clock cycles
Expand Down Expand Up @@ -160,6 +160,33 @@ function noNS($id) {
}
}

/**
* Returns the current namespace
*
* @author Nathan Fritz <fritzn@crown.edu>
*/
function curNS($id) {
return noNS(getNS($id));
}

/**
* Returns the ID without the namespace or current namespace for 'start' pages
*
* @author Nathan Fritz <fritzn@crown.edu>
*/
function noNSorNS($id) {
global $conf;

$p = noNS($id);
if ($p == $conf['start']) {
$p = curNS($id);
if ($p == false) {
return noNS($id);
}
}
return $p;
}

/**
* returns the full path to the datafile specified by ID and
* optional revision
Expand Down

0 comments on commit 1a84a0f

Please sign in to comment.