[Mediawiki-l] Change logo according to namespace

Platonides Platonides at gmail.com
Tue Aug 25 11:11:04 UTC 2009


Haim (Howard) Roman 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?
> 
> Thanks

You don't need to change the code.

At Mediawiki:Common.css set:
ns-0 #p-logo a {
 background-image: url(http://example.com/logo-main-namespace.png)
!important;
}
ns-1 #p-logo a {
 background-image: url(http://example.com/logo-talk-namespace.png)
!important;
}
and so on.

$wgLogo will be the default logo for those namespaces which you don't
override.




More information about the MediaWiki-l mailing list