[Mediawiki-l] Change logo according to namespace

Łukasz Garczewski tor at wikia-inc.com
Mon Aug 24 22:17:27 UTC 2009


On Mon, Aug 24, 2009 at 11:57 PM, Haim (Howard) Roman<roman at jct.ac.il> wrote:
> I'd like to change the logo (set by $wgLogo) according to the current
> namespace.  But how to get the current namespace?  The only way I can see is
> to call getNamespace(), e.g., in the Wiki.php of my wiki:
>
> $ret = Title::newFromURL( $title );
> ...
> $ret->getNamespace() != NS_SPECIAL
>
> Is that the way?  If so, how would I set "$ret" (in this case) to be the
> title of the current page?

Use the global $wgTitle object and call the method on that.

As long as you change the value os $wgLogo before the skin is output,
you should be fine.

Also, you might find docs/hooks.txt and interesting read, as well as
http://www.mediawiki.org/wiki/Manual:Hooks

Good luck!

-- 
Lucas 'TOR' Garczewski
Wikia Tech Team



More information about the MediaWiki-l mailing list