Extension talk:SubPageList2

There is a bug in the following function:

function options( $options ) with the namespace option extraction.

A fix for the bug in question could be:

if( isset( $options['namespace'] ) ) {     if( is_numeric( $options['namespace'] ) ) $this->namespace = intval($options['namespace']); else if( is_string( $options['namespace'] ) ) {       	if( $this->language->getNsIndex( $options['namespace'] ) !== false ) $this->namespace = $this->language->getNsIndex( $options['namespace'] ); else $this->error( "Using not defined namespace." ); } 		else $this->error( "Unknown value for option namespace." ); }

Europäische Union
Im ZUM-Wiki habe ich eine Liste von Unterseiten für die Seite Europäische Union angelegt:
 * http://www.zum.de/wiki/index.php/Europ%C3%A4ische_Union#Unterseiten

Der Quelltext: 

Das Ergebnis: * Europäische Union * Ratspräsidentschaft der BRD * Verfassungsentwurf der EU

Wie kann die Anzeige verbessert werden? --Karl.Kirst 21:00, 7 January 2007 (UTC)

Auf der verlinkten Seite im ZUM-Wiki scheint inzwischen keine SubPageList mehr verwendet zu werden. Das beschriebene Problem tritt jedoch auch bei mir auf: Als erster Punkt in der Liste der Unterseiten taucht immer der Titel der aktuellen Seite auf (Mediawiki 1.6.8, das Wiki ist nicht öffentlich, daher leider kein Link). --195.226.123.200 07:53, 12 January 2007 (UTC)


 * SubPageList2 dürfte euch helfen. Das Beispiel müsste nun so aussehen:


 * --Schaelle 19:16, 28 March 2007 (UTC)

deepness (argument)?
Shouldn't that rather be "depth"?!
 * Hm, I'm german. It can. Feel free to change, its OpenSource and I'm no more developing the extension. --Schaelle 19:13, 28 March 2007 (UTC)

Exploration - what works and what doesn't, and beware of NESTING!

 * Frommediawiki-l/2007-July/021532.html::> Earlier: if I have a page A, and I create a
 * > subpage, A/B/C, but A/B does not exist, 
 * > then A/B/C will automatically link back to
 * > A, but not A/B, since it doesn't exist. 
 * > > Yes. 
 * > The question is, what happens if I now
 * > create A/B after A/B/C is already
 * > created. Will the wiki recognize that
 * > A/B/C is a subpage of A/B? 
 * > > Yes. 
 * > A/B/C is a subpage of A/B? 
 * > > Yes. 
 * > > Yes. 


 * Frommediawiki-l/2007-July/021551.html::''> > A search for "subpage" on MediaWiki.org returns,
 * ''> > among the top three hits,
 * http://www.mediawiki.org/wiki/Manual:%24wgNamespacesWithSubpages
 * Manual:LocalSettings.php.
 * ''> > In the absence of a decent page explaining
 * ''> > it, I'll fill in, in brief, that when "subpages"
 * ''> > are enabled for a namespace, MediaWiki considers,
 * ''> > e.g. "Page/Subpage" in a title to be more
 * ''> > meaningful; it will show little "breadcrumb"
 * ''> > navigation links at the top of the page.
 * ''> > Note that whether or not subpages are enabled,
 * ''> > one can find all titles matching a pattern,
 * ''> > e.g. "Page/*" using Special:Prefixindex.


 * (Note: > above = "DI", > > = "RC")

Peter Blaise asks:

--

Q1: you say that a subpage automatically *links* back to the page it's a sub of? What do you mean by *links*? I see no auto anything on my subpages or on the pages they are a subpage of (v1.10.0). Can you show an example of what "automatically *link* back" looks like?

A1: See second quote above! Thank you Rob.

--

Q2: And why would we do this? What tools in MediaWiki help us search, sort and select/display/print the data that is organized as subpages such as "a", "a/b", and "a/b/c"?

I just built these pages and a few more to experiment:


 * a
 * a/b
 * a/b/c
 * a/a
 * a/b/a
 * a/b/b
 * a/a/a/a
 * a/a/a/b
 * b
 * b/a
 * b/a/a
 * b/a/b
 * b/b
 * b/b/a
 * b/b/b
 * b/b/c

... and so on, for way more pages than I probably need (I have a lot of cleaning up to do after this test!). All the red links above for me in my own private wiki are actually live blue links to the articles and subpages.

On each "a" page I put the word "ardvark". On each "b" page I put the word "bayonette". On each "c" page I put the word "carlisle".

... and so on. These are words I knew were NOT in my wiki otherwise (hey, misspellings can be useful during testing).

Results:


 * - ALL these pages, including sub pages, show up in special:allpages.


 * - A [ search ] for ardvark, bayonette or carlisle finds ALL pages, including sub pages, that contain the words searched for.

I cannot divine a MediaWiki-native way to show ONLY pages below "a" or ONLY pages below "a/b" or any other limit or control of focus over where the search/sort/select looks. (v1.10.0)

--

Q3: Does anyone know of tools within MediaWiki (or extensions) that provide such a result? I thought someone mentioned that subpages automatically get a listing in or to the article/page they are an subpage of, but that's not happening (v1.10.0)

As far as I can tell, a value for me of a subpage is to allow me to have otherwise identically named subpages under different articles with otherwise different contents, like this list of article/pages keeping track of, say, computer resources:


 * Computer1
 * Computer1/hardware-inventory
 * Computer1/service-history
 * Computer1/software-inventory
 * Computer1/user-list
 * Computer2
 * Computer2/hardware-inventory
 * Computer2/service-history
 * Computer2/software-inventory
 * Computer2/user-list
 * Computer3
 * Computer3/hardware-inventory
 * Computer3/service-history
 * Computer3/software-inventory
 * Computer3/user-list

--

Q4: how would I list all pages ONLY under Computer1, for instance? (Read on, I found an answer.)

A4: I found this extension:


 * Extension:SubPageList2

... and found it's php file here:


 * http://stuff.schaelle.de/SubPageList2/SubPageList2.zip

... and put it's php file here:


 * ..\extensions\subPage2.php

... and added the following lines using a text editor to ..\LocalSettings.php

require_once("extensions/SubPageList2.php");
 * 1) for SubPageList extension

Then I confirmed by using Special:Version and saw:

Subpage List 2 Martin Schallnahs, Rob Church

Thanks, Martin and Rob! Then, after printing and reading the "documentation" and casting out much that failed to work as described, I found that THIS worked when typed in as the text contents of a page that has subpages:

< subpages deepness=1 / >

And then I see THIS as it's contents when rendered (from my expanded a/b/c example above), for example, let's add those lines to page "a" - then it shows this:


 * A
 * ardvark
 * A/a
 * A/a/a/a
 * A/a/a/a/z
 * A/a/a/b
 * A/b
 * A/b/a
 * A/b/b
 * A/b/c
 * A/z
 * A/b/c
 * A/z

... again, all the red links above for me in my own private wiki are actually live blue links to the subpages. THIS feature I can use as a benefit to show a clickable table of contents list of all subpages under, say, Computer1. GREAT!

--

Q5: How would I list all "*/hardware-inventory" pages only?

A5: I could create a category and categorize them, then the special page [category:Service-history] will display a clickable table of contents, and the fact that they are all subpages is irrelevant:


 * Articles in category "Service-history"
 * There are 3 articles in this category.
 * C
 * Computer1/service-history
 * Computer2/service-history
 * Computer3/service-history
 * Computer1/service-history
 * Computer2/service-history
 * Computer3/service-history

Good. Unless, I also have a < subpages/ > command IN the "Computer1" article page, which I want to do. Then, the < subpages/ > command bets interpreted first, ad MediaWiki thinks the "computer1" page also is in the [category:service-history] page:


 * Articles in category "Service-history"
 * There are 6 articles in this category.
 * C
 * Computer1
 * Computer1/service-history
 * Computer2
 * Computer2/service-history
 * Computer3
 * Computer3/service-history
 * Computer2/service-history
 * Computer3
 * Computer3/service-history

Lesson? Plan my nesting carefully, and maybe learn to modify and enhance the extension to make it more disciplined.

Now, oddly enough, it seems that the "subpages" extension is smarter in a dumb way in that I just tried a sample article/page called "z" and added to it's text contents merely < subpages / > and got a list of ONLY other pages at the same level (immediately "under" the main namespace) which happen to also have "z" in their titles - anywhere within the title! But no subpages! Cool. This feature could make a strange indexer or sorts.

But when I type THIS into the text of *any* page:

< subpages parent=a / >

I get this:


 * A/a/a/a
 * A/a/a/a/z
 * A/a/a/b
 * B/a/a

Not "all children of any 'a' page" as I expected, but sort of, "only all *terminus* pages whose *immediate* parent is an 'a' page". Weird. I was expecting "all sub pages of any 'a' parent", which SHOULD have yielded:


 * A
 * A/a
 * A/a/a
 * A/a/a/a
 * A/a/a/a/z
 * A/a/a/b
 * B/a/a

THIS odd behavior is why I've been so often frustrated when trying to follow directions but have gotten different results than the original programmer got in their environment - change ONE thing and all logic falls away! =8 ^ o

--

Q6: How to get the list above, "all subpages of any parent named 'a'", on demand?

I also tried simplifying using the "showpath=no" argument:

< subpages parent=a showpath=no / >

But that just returns:


 * a
 * z
 * b
 * a

Which is which? So, "showpath=no" seems a tough option to find value for in my examples.

So, as hinted to above in the category exploration, the funny thing about the < subpages / > command is, if they are called or nested, the < subpages / > command seems to get interpreted/parsed as if it was on the calling page, not on the page where it sits. For example, on page "a/b" containing only the text < subpages / >, when I open the page directly, it shows a list as expected with only itself and it's own subpages, like this:


 * A/b
 * ardvark bayonette
 * A/b
 * A/b/a
 * A/b/b
 * A/b/c
 * A/b/b
 * A/b/c

Yet, when this "a/b" page gets called, nested, found, referred to, and or included in another article/page's list, then it gets interpreted/parsed as if it were resting in/on the CALLING page, no longer as if it were on it's own original the "a/b" page. Argh! Example, if on page "a" I put something like:

< subpages deepness=1 / >

I get a list of subpages under the current "a" page":


 * A
 * ardvark
 * A/a
 * A/a/a/a
 * A/a/a/b
 * A/b
 * A/b/a
 * A/b/b
 * A/b/c
 * A/z
 * A/b/c
 * A/z

BUT, if in page "a" I add the preview feature:

< subpages deepness=1 mode=preview / >

It shows the contest of each subpage, but when it shows the contents of the subpage "a/b" in the list, the "a/b" call for showing < subpages / > suddenly shows all subpages of the entire "main namespace" equal in level to the calling "a" page, not to the original source of just the subpages of "a/b"!

So, I must be careful not to nest the subpage extension command else it will behave differently when nested than it does when it's not nested.

Thanks for exploring.

-- Peter Blaise peterblaise 16:51, 6 July 2007 (UTC)

PS - Why don't category links show up as red when they don't exist? I would expect to render like this:   rather than disappear altogether! I guess because they expect categories to render at the bottom of the page only after editing is done, they "disappear" form the preview display during editing. Quirky!

List on seperate page
We make extensive use of subpages and it would be really good if the tab could be placed on a different page i.e currently the code has to be placed on the root page and it lists subpages below that root, I'd like to be able to have say


 * Page XYX
 * Page XYZ/Sub1
 * Page XYZ/Sub2
 * Page XYZ/Sub2/subsub1
 * Page XYZ/Sub2/subsub2
 * Page XYZ/Sub2/subsub3
 * Page XYZ/Sub3
 * Page XYZ/Sub4

and then have a page such as


 * Page XYZ contents

and put the tag on so that it would list all the subpages of the parent defined

"deepness" problem
This extension is exactly what I need to create a dynamic directory of all the pages on the Wiki I am building. However, deepness does not seem to be working. If I put the following on the page RSView

I get:

RSView/Utilities RSView/Utilities/Alarms RSView/Utilities/Blue Dryer RSView/Utilities/Chillers RSView/Utilities/Chillers/Maintenance Mode RSView/Utilities/Loaders RSView/Utilities/Portable Dryers RSView/Utilities/Towers RSView/Utilities/Towers/Maintenance Mode RSView/Utilities/Troubleshooting RSView/Utilities/White Dryer

However, I just want

RSView/Utilities

It appears that the deepness is not working. Has anyone else seen this or am I doing something wrong?

This is a big problem for me too
I am trying to catalog some statutes/regulations I consult on a regular basis, but want a way to view only the single level below in the hierarchy.

For example, on a page entitled "U.S.C./31"

using this: Title 31 of the U.S. Code 

Gives this:


 * Title 31 of the U.S. Code.


 * * 31/3729
 * * 31/3729/a
 * * 31/3729/b

But what I want is this:


 * Title 31 of the U.S. Code.
 * * 3729

Using Title 31 of the U.S. Code 

is even more useless, returning this:


 * Title 31 of the U.S. Code.


 * * 3729
 * * a
 * * b

In both instances, I've tried fooling it an entering ignore="/" as a parameter, but that doesn't do anything.

Any suggestions?

Fungiblename 14:51, 19 January 2008 (UTC)

Forum
Die Discussion-Seiten sind zu nichts zu gebrauchen. Warum funktioniert es nicht wie ein richtiges Forum?

Category parameter
This extension seems to work fine and is quite useful.

However, I can't seem to get the category parameter to work. Nothing at all happens. I'm using MediaWiki 1.9.1 and Subpage List 2 (version 1.0 (2006-10-02)).

Any ideas?

--C4duser 22:19, 14 February 2008 (UTC)

Supress TOC while using previewmode
Hello,

this ext is quite useful to me, but one thing disturbes the good output. i have a page called birthdays and a single subpage for each day of the year with individual birthdays of users of my wiki to dynamically include the current day on the mainpage. the page "birthday" should also display all pages in preview mode. therefore i use the following code:

=List of Birthdays = 

This forces a TOC between the headline and the subpages list. is there a way to supress the TOC. unfortunately does not seem to work at all in this case. thanks a lot in advance best regards --TurboKanne 14:15, 26 March 2008 (UTC)

Bug report: Doesn't work with parenthesis in title.
I've been using this extension for some time and find it extremely useful. However, I've recently come across a bug and wonder how it can be fixed. I'm using MediaWiki version 1.9.1.

The problem is with page titles with parenthesis at the end, as follows:

Namespace:Page Title (ABC)

Sub-pages of this page won't work with SubPageList2. If the (ABC) is removed, it works fine. Since values in parenthesis are useful on my wiki, I wonder if there is a fix for this?

Thanks.

--C4duser 05:28, 20 December 2008 (UTC)

Random Incorrect Subpage
No comments in 2.5 years, so I won't get my hopes up, bujt I wonder if anyone has encountered random incorrect subpage listings? I have a page called Writing that says one of its subpages is Some Other Page/Writing Exercises. Neither was moved/deleted/anything weird. No problems with subpages otherwise. It also lists Writing/Test when I create it. There is nothing codewise in the other page other than the same subpagesbox template. Ideas?