Not logged in. · Lost password · Register
Forum: General Help and Support Features and Functionality RSS
Choosing among different methods of providing the default namespace page
Avatar
clh #1
Member since May 2016 · 94 posts
Group memberships: Members
Show profile · Link to this post
Subject: Choosing among different methods of providing the default namespace page
There are three different ways in which a Dokuwiki user can provide a default page for a namespace. For example, consider the namespace bar that's inside namespace foo: its filesystem path is /var/www/html/data/pages/foo/bar/. The default page can be any of

/var/www/html/data/pages/foo/bar/start.txt (assuming $conf['start'] == 'start.txt')
/var/www/html/data/pages/foo/bar/bar.txt
/var/www/html/data/pages/foo/bar.txt

Any of these styles may be used. Navigating to the dokulink foo:bar will cause Dokuwiki to look for, in turn, each of the above styles until it finds one.

I don't see any particular reason to favor one style over the other (although I favor consistency). Why are multiple styles provided for, and are there advantages or disadvantages to consider?
Avatar
MartinR #2
Member since Jul 2015 · 143 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
I'd avoid the last one.  If you move the start page (commonly an index or explanation) away from the rest of the namespace, then should you ever want to move namespaces around/backup/restore you've just doubled your work and increased the chance of an accident.

Of the first two, it is a matter of designer's choice.  IMHO you need to consider what a reader would expect.  To take an example, I installed the documentation for Audicity on my computer yesterday. a quick look at the file names and I knew I wanted /usr/share/audacity/help/manual/index.html.  If the file had been called something else I'd have been hunting for it: bar.txt? foobar.txt? tuesdaysedit.txt?

Ultimately choice is freedom, selection is design.
Avatar
turnermm (Moderator) #3
Member since Oct 2009 · 4645 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
These are 2 different namespaces, bar and foo:

/var/www/html/data/pages/foo/bar/bar.txt
/var/www/html/data/pages/foo/bar.txt
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Avatar
clh #4
Member since May 2016 · 94 posts
Group memberships: Members
Show profile · Link to this post
I'm assuming the existence of the directory /var/www/html/data/pages/foo/bar/ in all cases.

So if ...pages/foo/bar.txt exists, but neither ...pages/foo/bar/bar.txt nor ...pages/foo/bar/$conf['start'] exist, then navigating to foo:bar will display ...pages/foo/bar.txt.
This post was edited on 2019-03-05, 14:33 by clh.
Avatar
MartinR #5
Member since Jul 2015 · 143 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
As an example I've just been into my playground and created the links:
  [[.foo]]

  [[.bar]]

  [[.foo:bar]]

  [[foo]]

  [[bar]]
I previewed them, and created the first three (open, create, type in "x" and save).  All five links then turned blue.  Going to each one in turn shows:
  [[.foo]]  -> start » playground » foo

  [[.bar]]  -> start » playground » bar

  [[.foo:bar]]  -> start » playground » foo » bar   (NB, "foo" is in red)

  [[foo]]  -> start » playground » foo

  [[bar]]  -> start » playground » bar
and as a final check:
  $ find playground/
  playground/
  playground/bar.txt
  playground/foo.txt
  playground/foo
  playground/foo/bar.txt
  playground/playground.txt

Which shows that as Myron indicated there are two namespaces, in this case playground and playground:foo in your original as foo and foo:bar.  You can therefore have your original form 3, but I would still advise against it.  As I originally mentioned, you will get caught out if you attempt to move such dual-rooted structures. :blush:   Far better to have a nice namespace with its index and introduction within it.
Avatar
clh #6
Member since May 2016 · 94 posts
Group memberships: Members
Show profile · Link to this post
@MartinR - I see your point about tucking the default namespace page inside the directory.

I seem to be missing some subtlety here. I understand that playground/ and playground/foo/ (to use your example) are two different namespaces; but I think I'm correct in saying that playground/foo.txt, playground/foo/foo.txt, and playground/foo/start.txt are the three possible ways to store playground:foo's default namespace. I only included playground so there would be a parent directory for foo/.
Avatar
MartinR #7
Member since Jul 2015 · 143 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
1)  playground/ is a namespace.  Namespaces are physically directories (aka folders).
2)  playground/foo/ is another namespace.  It may be within playground/ namespace but it is a different namespace.
3)  playground/foo.txt is a page (file) called "foo" lying within the playground/ namespace.
4)  playground/foo/foo.txt is a different page, also called "foo", but lying in the namespace playground/foo/
5)  playground/foo/start.txt is a page called "start" within the playground/foo/ namespace.

There is no "default namespace", there is a default page.  Namespaces are directories and hold files, they don't hold information.  Files contain text and hold information, they don't hold namespaces.

Consider the following example:  I create two namespaces: books to hold my book catalogue and dvds for DVDs.  I'll assume the base is playground simply to make playing around easier.

playground.txt holds:
  Welcome to my life

  * See my [[books:]]
  * See my [[DVDs:]]
Please note the trailing colons!  The two links will go to the default file within each separate namespace.  There will be no playground/books.txt and playground/dvds.txt.

Consider now playground/books/start.txt.  When you click the "books" link above then this page is displayed:
  * [[wlg|The Wiki-lover's Guide]]
  * [[msp|Microsoft problems]]
  * [[Penguins rule]]
Because we are now in the playground/books/ namespace clicking on one of those links will display playground/books/wlg.txt, playground/books/msp.txt or playground/books/penguins_rule.txt respectively.

Quite seriously, the best advice I can give you is to relax and stop fighting the system.  Developers such as Andi and Myron have done most of the hard work for you and if you just relax and go with the flow you will get a straightforward usable system.  To create the model above do:

1) Edit playground.txt.
2) Save.  Click on one of the red links (say "books").
3) When prompted select "Create" from the toolbar.  The namespace and default file will be automatically created for you.
3) Edit the file which you've just created.  Insert links to pages about your books.  You do not need to specify the namespace, the system knows where you are.
4) Click on a book redlink, allow the system to create it and then add in whatever text about the book you wish to save.
Avatar
turnermm (Moderator) #8
Member since Oct 2009 · 4645 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
In reply to post #6
the three possible ways to store playground:foo's default namespace.

I think your terminology is getting in the way.  The above statement doesn't really mean much to me, urls don't store, they access or refer.  Dokuwiki's namespace structure is based on the directory structure of the file system.  If you create a url which does not refer to a page, because the page name does not exist, and if the url refers to a directory, then dokuwiki links to the default start page in that directory.  This refers to a directory: playground/foo/.  If you link to that directory, and it has no start page, you will get playground/foo/start.txt.   Dokuwiki comes with the wiki namespace pre-installed.  It has no start page.  So if you link to wiki, you will bring up wiki/start.

playground/foo.txt, playground/foo/foo.txt, and playground/foo/start.txt are the three possible ways to store playground:foo's default namespace.

This is not correct, if you mean all three refer to the same entity, and again I don't know what you mean by "store". 
    playground/foo.txt is foo.txt in the playground namespace/directory
    playground/foo/foo.txt, is foo.txt in the playground/foo namespace/directory
    playground/foo/start.txt is start.txt in the playground/foo namespace/directory.
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Avatar
clh #9
Member since May 2016 · 94 posts
Group memberships: Members
Show profile · Link to this post
I've found the source of my confusion.

Three or four years ago when we began designing our wiki, we weighed all three methods of naming and locating the "default namespace page" and consciously selected the third method, for reasons that none of us remembers. So for playground/foo/ the "default namespace page" was playground/foo.txt. At some point I must have written a link to playground:foo - without a trailing colon - thinking I was writing a link to the playground:foo: namespace, and it correctly showed the "default namespace page" -- but not because Dokuwiki had engaged its logic for finding the "default namespace page". My link, lacking the trailing colon, was pointing to a page, not a namespace, and it could just as well have been named xyzzy.txt. Anyway, that became the way I wrote all my links to namespaces, and it worked, just not for the reason I thought it was working.

Now it's clear to me that playground/foo/start.txt is probably the best choice. And that the correct way to write a link to a namespace is [[playground:foo:]].
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-06-24, 22:12:08 (UTC +02:00)