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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Haim (Howard) Roman Computer Center, Jerusalem College of Technology Phone: 052-8-592-599 (6022 from within Machon Lev)
On Mon, Aug 24, 2009 at 11:57 PM, Haim (Howard) Romanroman@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!
Thanks. I'll try it. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Haim (Howard) Roman Computer Center, Jerusalem College of Technology Phone: 052-8-592-599 (6022 from within Machon Lev)
2009/8/25 Łukasz Garczewski tor@wikia-inc.com
On Mon, Aug 24, 2009 at 11:57 PM, Haim (Howard) Romanroman@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
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.
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@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.
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) Romanroman@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@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.
Hi,
2009/8/25 Haim (Howard) Roman roman@jct.ac.il:
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; }
try adding a dot in front of the ns-0, as I think the ns-0 (and ns-1 etc) refer to class names.
and refresh the browser CSS cache by reloading with Ctrl-F5 or your browser equivalent.
Thanks. With the dot in front, it worked! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 21:24, Jean-Marc van Leerdamj.m.van.leerdam@gmail.com wrote:
Hi,
2009/8/25 Haim (Howard) Roman roman@jct.ac.il:
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; }
try adding a dot in front of the ns-0, as I think the ns-0 (and ns-1 etc) refer to class names.
and refresh the browser CSS cache by reloading with Ctrl-F5 or your browser equivalent.
mediawiki-l@lists.wikimedia.org