On Sat, 06 Jul 2013 06:36:40 -0700, Adam Nielsen <[email protected]>
wrote:
Does anyone know how I might go about discovering whether I'm viewing
Special:WhatLinksHere from within a SkinTemplateNavigation hook?
Well as usual asking the question is all you need to find the answer
out yourself ;-)
I found I can use Title::isSpecial() to check for a specific page. In
my case I check $wgTitle->isSpecial('Whatlinkshere'), which is true if
I'm looking at Special:WhatLinksHere.
I'll also need the name of the page being investigated ("SomePage" in
the above example) so I can use it in a URL.
Unfortunately this hasn't been so easy. The docs suggest
Title::getSubpageText() would almost work (it's supposed to return
"Baz" from "User:Foo/Bar/Baz" which isn't enough, I need "Bar/Baz") but
again it doesn't seem to work properly on the special page and it
returns "WhatLinksHere/User:Foo/Bar/Baz" instead.
Any idea how I can get rid of "WhatLinksHere" from the front?
Thanks,
Adam.
Do NOT use $wgTitle. Besides being an awful global it's the wrong title
here.
Use $skin->getRelevantTitle() to get the title used for tabs.
--
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://danielfriesen.name/]
_______________________________________________
MediaWiki-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l