Hi,
is it possible to link to the parent page automatically? E.g. using a special variable ?
Let's say, I have: 1. Home 1.1 Chapter 1 1.1.1 Section 1
On Section 1 the link to Chapter 1 should be displayed, on Chapter 1 the link to Home.
Thanx
Dorthe
On Tue, 01 Mar 2005 01:16:07 +0100, Dorthe Luebbert luebbert@globalpark.de wrote:
Hi,
is it possible to link to the parent page automatically? E.g. using a special variable ?
MediaWiki doesn't really have a concept of "parent page" - it's not a hierarchical structure. That said, there is limited support for a "sub-pages" system, which is disabled by default for the main namespace to encourage a "web" rather than "tree" structure, which was deemed to be much more useful (specifically, in the context of an encyclopedia, but the same arguments apply to many other projects too). And it does indeed provide links to the "parents" of pages. But it is based entirely on the names of the pages - [[Section 1/Page 1]] would be a "sub-page" of [[Section 1]], and [[Section 1/Page 1/Supplement]] would be a "sub-page" of that. You might find that rather limiting and ugly - or maybe it would be exactly what you were after.
I couldn't find any very good documentation on this, but DefaultSettings.php conatins the following:
/** Which namespaces should support subpages? * See Language.php for a list of namespaces. */ $wgNamespacesWithSubpages = array( -1 => 0, 0 => 0, 1 => 1, 2 => 1, 3 => 1, 4 => 0, 5 => 1, 6 => 0, 7 => 1, 8 => 0, 9 => 1, 10 => 0, 11 => 1);
So to enable sub-pages in the main namespace, you would add something like the following to your LocalSettings.php (setting namespace 0 to '1' to represent 'yes, this one has sub-pages'). Pages with a "/" in their names would then be interpretted as though they were a sub-page of something else.
$wgNamespacesWithSubpages = array( -1 => 0, 0 => 1, 1 => 1, 2 => 1, 3 => 1, 4 => 0, 5 => 1, 6 => 0, 7 => 1, 8 => 0, 9 => 1, 10 => 0, 11 => 1);
The only effect I can think of other than automatically linking parents is that links like [[/foo]] are interpretted as though you'd said [[<current page>/foo]]; and I think somebody may have implemented extra tricks like [[../foo]] meaning [[<parent of this>/foo]], but that may not be in mainstream releases yet (or ever).
Depending on the exact effect you're aiming for, you might also be able to do something with categories, or just have a template to make a consistent-looking link at the top of each page by doing something like {{parentlink|parent=Home}}
You can easily create a page with a list of links, and make by a little trick this list appear in all the pages you want: so when you add a page to the list, it will automatically appear in all the pages.
I use this to create a little slideshow of lessons on german grammar: See http://www.fxparlant.net/German_Gender
HOW TO: I just created a pages "Slide_German_Grammar" with my hierarchie (as a numbered list, but you can just write yourself the numbers)
#[[German_Gender]] #[[German_Declination]] #[[German_Rection]] #[[German_Voc]]
(actually I also added a little styling, but it's because I've enable a lot of html on my personal wiki: look at the source: http://www.fxparlant.net/mediawiki/index.php?title=Slide_German_Grammar&... )
Then I go to one of the pages (let's say "German_Gender") and I insert the page Slide_German_Grammar with this code (that's just the template trick, with ":" at the beginning to insert any page, not just those from the template namespace)
{{:Slide_German_Grammar}}
And you're done :-!!
Tell me if it helps
François
Dorthe Luebbert wrote:
Hi,
is it possible to link to the parent page automatically? E.g. using a special variable ?
Let's say, I have:
- Home
1.1 Chapter 1 1.1.1 Section 1
On Section 1 the link to Chapter 1 should be displayed, on Chapter 1 the link to Home.
Thanx
Dorthe
mediawiki-l@lists.wikimedia.org