Last modified: 2013-07-25 07:04:19 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T8747, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 6747 - Introduce a new Variable {{ROOTPAGENAME}} (similar to {{BASEPAGENAME}}
Introduce a new Variable {{ROOTPAGENAME}} (similar to {{BASEPAGENAME}}
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.22.0
All All
: Lowest enhancement with 2 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
: easy
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-07-19 21:18 UTC by Julian Fleischer
Modified: 2013-07-25 07:04 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Julian Fleischer 2006-07-19 21:18:15 UTC
Hello,

i hope that it is okay to request new features here in MediaZilla like it is done in other huge projects using 
bugzilla too. I would not know where else to put it.

It's just a small thing that should be fast implemented. It is about the Variables regarding the Pagename which is 
important for writing dynamic templates. My idea is to introduce a Variable Names ROOTPAGENAME which has similar 
content like BASEPAGENAME. ROOTPAGENAME should only contain the name of the topmost page without namespace, e.g. 
for "User:Name/Article/Subarticle" it should be "Name". BASEPAGENAME would be "Name/Article" here.

For those of you who think that this is not necessary to implement this let me show you a little example for what this 
is good for:

Recently i wanted to change a Template in our german wikipedia, Named Vorlage:Archiv. This is a template which can be 
included into archived-discussion pages. It is very common to store those archives in subpages. For example For 
wikipedia:de:Internetforum there are archives in wikipedia:de:Internetforum/Archiv/Diskussionsforum and 
wikipedia:de:Internetforum/Archiv/Webforum (this is because there were two articles once which have been combined in 
that new article and the old discussion-pages have been moved there). Similarily the heavy discussions on Mainpages 
are often moved to Mainpage/archive/date . I wanted to introduce a dynamic link into that template which point to the 
current discussion. If i used [[Discussion:{{BASEPAGENAME}}]] than it would point to a wrong page which does not 
exist. Here [[Discussion:{{ROOTPAGENAME}}]] would be needed.

greetings and the best wishes, Warhog
Comment 1 Rob Church 2007-06-09 16:01:45 UTC
You can use the {{#titleparts}} parser function to obtain this.
Comment 2 Daniel Friesen 2012-11-20 14:28:49 UTC
#titleparts requires the installation of an additional extension just to work. 

BASEPAGENAME is a misnomer and we should have had ROOTPAGENAME inside core a long time ago.

I see absolutely no reason to not include such a simple and basic magic word inside of core.
Comment 3 Brad Jorsch 2013-03-16 14:39:20 UTC
If someone wants to do this, it should be easy enough.

The Title object already has a "getRootText()" method that does exactly what you want, so you can just copy the code for {{BASEPAGENAME}} and change the call to "getBaseText()" to "getRootText()".

Look for "basepagename" in includes/parser/CoreParserFunctions.php, includes/parser/Parser.php, includes/MagicWord.php, and languages/messages/MessagesEn.php.

Then look for "BASEPAGENAME" in tests/parser/parserTests.txt and maintenance/fuzz-tester.php.

Then add mention in RELEASE-NOTES-1.21 (or whatever version we're up to once someone gets around to this), stick it in Gerrit, and add me as a reviewer.


(In reply to comment #2)
> BASEPAGENAME is a misnomer

Why shouldn't "Foo/Bar/Baz" be considered the base of "Foo/Bar/Baz/Quux"?

> I see absolutely no reason to not include such a simple and basic magic word
> inside of core.

So do it then.
Comment 4 Daniel Friesen 2013-03-16 23:05:09 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > BASEPAGENAME is a misnomer
> 
> Why shouldn't "Foo/Bar/Baz" be considered the base of "Foo/Bar/Baz/Quux"?
> 
> > I see absolutely no reason to not include such a simple and basic magic word
> > inside of core.
> 
> So do it then.

I have a bunch of changesets that need my attention and haven't had any time to work on MW stuff lately.
Comment 5 Gerrit Notification Bot 2013-04-21 14:13:31 UTC
Related URL: https://gerrit.wikimedia.org/r/60198 (Gerrit Change I71ef0a15c95c9145462f3aa7fdb3ed11dac79265)
Comment 6 db [inactive,noenotif] 2013-05-02 16:44:14 UTC
(In reply to comment #5)
> Related URL: https://gerrit.wikimedia.org/r/60198 (Gerrit Change
> I71ef0a15c95c9145462f3aa7fdb3ed11dac79265)

Status Merged

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links