[Mediawiki-l] Change logo according to namespace

Haim (Howard) Roman roman at jct.ac.il
Tue Aug 25 17:35:35 UTC 2009


I forgot to specify my version!

mediawiki 1.13.4
PHP 5.1.6 (apache2handler)
MySQL 5.0.45
Extensions: CategoryTree & Cite

httpd (Apache) v2.2.3-22, running on CentOS 5.3
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Haim (Howard) Roman
Computer Center, Jerusalem College of Technology
Phone: 052-8-592-599 (6022 from within Machon Lev)



On Tue, Aug 25, 2009 at 20:32, Haim (Howard) Roman<roman at jct.ac.il> wrote:
> I'm afraid that the following method did not work for me.  It always
> gives the logo that $wgLogo is set to.  At the end, I tried this:
>
>    ns-0 #p-logo a {
>      background-image: url(http://ezrat.jct.ac.il/images/meshi_logo.png)
>      !important;
>    }
>
> And even in the main name space, the logo stays the default.  Yes,
> http://ezrat.jct.ac.il/images/meshi_logo.png is accessible in the
> browser.
>
> The problem might be that you took for granted something I'm very
> ignorant.  I know very little about CSS.  And I could not find where
> "ns-0" was defined.  Maybe the following are causing this problems:
>
>   [1] the site is in Hebrew
>   [2] I have custom name spaces (but I tried it also with ns-0)
>
> I'll look at Łukasz Garczewski's suggestion when I have time.
>
> Thanks
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Haim (Howard) Roman
> Computer Center, Jerusalem College of Technology
> Phone: 052-8-592-599 (6022 from within Machon Lev)
>
>
> On Tue, Aug 25, 2009 at 14:11, Platonides <Platonides at gmail.com> wrote:
>>
>> 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