Hello,
I am trying to change the way the title of pages in a specific namespace are displayed. All pages in this namespace (Lesson:) contain a <wikibabel> tag, which I've registered with the parser using $wgParser->setHook( 'wikibabel', 'efWikiBabelRender' ); I'm also using the ParserAfterTidy hook to prevent mediawiki amending my extension's html output, as was explained in the mediawiki manual.
It all works fine, but I would like to modify the way the page title (both <title> and <h1>) is shown, just to make it look a bit more sexy. I've tried using $wgOut->setPageTitle(), but somehow it gets overwritten by subsequent calls from somewhere else in the page displaying process.
If I call setPageTitle from the BeforePageDisplay hook, I get the <h1> to display what I want, but <title> does not seem to hear me. setHTMLTitle does nothing either.
Any ideas how I could do that? Just to be extra clear, I'm not trying to change the actual page title, only how it's displayed. (ideally, if there's some method to do it throughout the wiki, it would be great). The reason why I'm doing all this is to try and make the title easily parsable. If that's stupid, and you can think of a better way to do it, I'm open to suggestions :) An example page would be: http://www.wiki-babel.org/en/Lesson:Fra:1:The_survival_kit
cheers, Laurent
Can you do it with CSS? If your namespace number is (say 8), you'd put in Mediawiki:Common.css:
body.ns-8 #firstHeading { // your styles here }
Or how about with JavaScript in Mediawiki:Common.js? Check the namespace, grab the element with ID "firstHeading", and transform the text?
DanB
-----Original Message----- I am trying to change the way the title of pages in a specific namespace are displayed....
Laurent Savaete wrote:
Hello,
I am trying to change the way the title of pages in a specific namespace are displayed. All pages in this namespace (Lesson:) contain a <wikibabel> tag, which I've registered with the parser using $wgParser->setHook( 'wikibabel', 'efWikiBabelRender' ); I'm also using the ParserAfterTidy hook to prevent mediawiki amending my extension's html output, as was explained in the mediawiki manual.
It all works fine, but I would like to modify the way the page title (both <title> and <h1>) is shown, just to make it look a bit more sexy. I've tried using $wgOut->setPageTitle(), but somehow it gets overwritten by subsequent calls from somewhere else in the page displaying process.
If I call setPageTitle from the BeforePageDisplay hook, I get the <h1> to display what I want, but <title> does not seem to hear me. setHTMLTitle does nothing either.
Any ideas how I could do that? Just to be extra clear, I'm not trying to change the actual page title, only how it's displayed. (ideally, if there's some method to do it throughout the wiki, it would be great). The reason why I'm doing all this is to try and make the title easily parsable. If that's stupid, and you can think of a better way to do it, I'm open to suggestions :) An example page would be: http://www.wiki-babel.org/en/Lesson:Fra:1:The_survival_kit
cheers, Laurent
No need for a custom tag. You can use {{DISPLAYTITLE: }} You need $wgRestrictDisplayTitle to be able to set any title. See http://www.mediawiki.org/wiki/Manual:$wgAllowDisplayTitle http://www.mediawiki.org/wiki/Manual:$wgRestrictDisplayTitle
Thanks Platonides, the {{DISPLAYTITLE:}} trick works fairly well (to avoid having to modify and hardcode the title in the page, I used $wgOut->addWikiText), except that somehow the HTML title is set before the call to my tag renderer (which I need for other purposes). Subsequent calls to setHTMLTitle don't seem to have any effect. Is this the expected behaviour?
thanks again for your help, Laurent
2010/10/5 Platonides Platonides@gmail.com:
Laurent Savaete wrote:
Hello,
I am trying to change the way the title of pages in a specific namespace are displayed. All pages in this namespace (Lesson:) contain a <wikibabel> tag, which I've registered with the parser using $wgParser->setHook( 'wikibabel', 'efWikiBabelRender' ); I'm also using the ParserAfterTidy hook to prevent mediawiki amending my extension's html output, as was explained in the mediawiki manual.
It all works fine, but I would like to modify the way the page title (both <title> and <h1>) is shown, just to make it look a bit more sexy. I've tried using $wgOut->setPageTitle(), but somehow it gets overwritten by subsequent calls from somewhere else in the page displaying process.
If I call setPageTitle from the BeforePageDisplay hook, I get the <h1> to display what I want, but <title> does not seem to hear me. setHTMLTitle does nothing either.
Any ideas how I could do that? Just to be extra clear, I'm not trying to change the actual page title, only how it's displayed. (ideally, if there's some method to do it throughout the wiki, it would be great). The reason why I'm doing all this is to try and make the title easily parsable. If that's stupid, and you can think of a better way to do it, I'm open to suggestions :) An example page would be: http://www.wiki-babel.org/en/Lesson:Fra:1:The_survival_kit
cheers, Laurent
No need for a custom tag. You can use {{DISPLAYTITLE: }} You need $wgRestrictDisplayTitle to be able to set any title. See http://www.mediawiki.org/wiki/Manual:$wgAllowDisplayTitle http://www.mediawiki.org/wiki/Manual:$wgRestrictDisplayTitle
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org