[dokuwiki] Re: Namespace confusion
- From: Guy Brand <gb@xxxxxxxxxxxxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Sat, 11 Mar 2006 10:23:26 +0100
On 11 March at 13:47, Alex Wang wrote:
> I start a new DokuWiki installation, on the home page I create a link
> [[ns1:]]. This link will create a page called ns1 under the root
> namespace. Then in this ns1 page, I need to use [[ns1:page1]] to create
> "page1" under ns1.
>
> Doesn't this seem counter-intuitive? I would have thought the ns1 page
> itself to be logically under the ns1 namespace already.
That's because the internal link [[ns1:]] gets trimmed to [[ns1]] by
the parser and thus the page name is ns1.txt in the root namespace.
How could dokuwiki choose the name of the page if the [[ns1:]] link
was not cleaned up? There is no default page name for namespace
(except for the root namespace which has $conf['start']).
The attached patch changes this behavior of dokuwiki defining
$conf['start'] as the default page for any namespace and not
trimming [[ns1:]] alike links (which get expanded to
[[ns1:$conf['start']]]).
> So I go and instead create the link [[ns1:intro]] as the "home" page for
> that namespace. Then on the intro page, I can just use [[page1]] to
> create the ns1:page1 page. But...now if I use the "you are here"
> breadcrumbs, it will show "home >> ns1 >> intro" with the "ns1" in red.
ns1 is probably red because ns1.txt page in the root namespace does
not exist.
--
gb
--- ../../current/inc/pageutils.php Fri Mar 3 09:56:13 2006
+++ pageutils.php Fri Feb 24 23:07:20 2006
@@ -23,6 +23,14 @@
$id = $_REQUEST[$param];
+ //globalstart
+ if($conf['globalstart']) {
+ if((substr($_REQUEST['id'], -1) == "/") || (substr($_REQUEST['id'], -1)
== ":")) {
+ $id .= $conf['start'];
+ }
+ }
+
+
//construct page id from request URI
if(empty($id) && $conf['userewrite'] == 2){
//get the script URL
@@ -99,7 +107,11 @@
//clean up
$id = preg_replace($sepcharpat,$sepchar,$id);
$id = preg_replace('#:+#',':',$id);
- $id = trim($id,':._-');
+ if($conf['globalstart']) {
+ $id = trim($id,'._-');
+ } else {
+ $id = trim($id,':._-');
+ }
$id = preg_replace('#:[:\._\-]+#',':',$id);
return($id);
- Follow-Ups:
- [dokuwiki] Re: Namespace confusion
- From: Alex Wang
- [dokuwiki] Re: Namespace confusion
- From: Shai
- References:
- [dokuwiki] Namespace confusion
- From: Alex Wang
Other related posts:
- » [dokuwiki] Namespace confusion
- » [dokuwiki] Re: Namespace confusion
- » [dokuwiki] Re: Namespace confusion
- » [dokuwiki] Re: Namespace confusion
- » [dokuwiki] Re: Namespace confusion
- » [dokuwiki] Re: Namespace confusion
- » [dokuwiki] Re: Namespace confusion
- » [dokuwiki] Re: Namespace confusion
- » [dokuwiki] Re: Namespace confusion
- [dokuwiki] Re: Namespace confusion
- From: Alex Wang
- [dokuwiki] Re: Namespace confusion
- From: Shai
- [dokuwiki] Namespace confusion
- From: Alex Wang