Hi
I'm just upgrading from 1.16.2 to 1.18.1. Everything seems to be fine apart from a custom skin (the built-in skins work ok). The skin ('Resources') is a small variation on Vector. When I switch $wgDefaultSkin to my skin, the skin code gets called but no css is loaded. I've tried starting again by copying Vector.php to Resources.php, copying vector/* to resources/*, and changing all references to '[Vv]ector to '[Rr]esources' in Resources.php, but the css is still ignored.
As you can tell from this description I don't know how the skin system works in any depth and am hacking away blindly. Can anyone suggest where I might be going wrong?
Thanks Graham
On Mon, 27 Feb 2012 15:36:59 -0800, Graham Seaman graham@theseamans.net wrote:
Hi
I'm just upgrading from 1.16.2 to 1.18.1. Everything seems to be fine apart from a custom skin (the built-in skins work ok). The skin ('Resources') is a small variation on Vector. When I switch $wgDefaultSkin to my skin, the skin code gets called but no css is loaded. I've tried starting again by copying Vector.php to Resources.php, copying vector/* to resources/*, and changing all references to '[Vv]ector to '[Rr]esources' in Resources.php, but the css is still ignored.
As you can tell from this description I don't know how the skin system works in any depth and am hacking away blindly. Can anyone suggest where I might be going wrong?
Thanks Graham
One possibility why it stopped working on upgrade might be that the outdated css loading calls may not be loading the stylesheet. The near-guaranteed reason why copying Vector.php and editing it isn't working is because like everyone else you are changing `$out->addModuleStyle( 'skins.vector' );` to `$out->addModuleStyles( 'skins.resources' );` which naturally won't work because RL modules are not defined in skin files and hence the skins.resources module does not exist.
In any case, trying to create a new skin by copying the core skins is a really bad idea. Core skins use the old autoloader and hence their resources are mixed in with the rest of core instead of properly isolated as a skin. They also may have bad practices in them to retain old behaviors that are expected of them, stuff which new skins have no reason to do. And most of all, by copying them your copy gets out of sync and when you upgrade you have to deal with the fact that the code you copied is out of date. You also duplicate what you don't need to duplicate.
If you want to create a skin that just makes css tweaks to a core skin, I suggest something like this: https://gist.github.com/1927993
You would put a yourskinname.php and YourSkinName.skin.php file inside `skins/yourskinname/` as in that "Scalar" skin example above. And then add a yourskinname/screen.css which would contain the css tweaks you want to vector. And then require_once that from your LocalSettings.php
This way you inherit everything from vector and don't have to copy anything.
On 02/28/12 00:00, Daniel Friesen wrote:
One possibility why it stopped working on upgrade might be that the outdated css loading calls may not be loading the stylesheet. The near-guaranteed reason why copying Vector.php and editing it isn't working is because like everyone else you are changing `$out->addModuleStyle( 'skins.vector' );` to `$out->addModuleStyles( 'skins.resources' );` which naturally won't work because RL modules are not defined in skin files and hence the skins.resources module does not exist.
Exactly. I did wonder about this, but couldn't see what else to do. I don't know what an 'RL module' is.
In any case, trying to create a new skin by copying the core skins is a really bad idea. Core skins use the old autoloader and hence their resources are mixed in with the rest of core instead of properly isolated as a skin. They also may have bad practices in them to retain old behaviors that are expected of them, stuff which new skins have no reason to do. And most of all, by copying them your copy gets out of sync and when you upgrade you have to deal with the fact that the code you copied is out of date. You also duplicate what you don't need to duplicate.
If you want to create a skin that just makes css tweaks to a core skin, I suggest something like this: https://gist.github.com/1927993
I want to:
- hide most of the normal user options (I switch skin on login, non-logeddin users see an apparently static web site with no editing options or discussion pages)
- Add new logo & colour scheme to top of page
- Add some extra external links
You would put a yourskinname.php and YourSkinName.skin.php file inside `skins/yourskinname/` as in that "Scalar" skin example above. And then add a yourskinname/screen.css which would contain the css tweaks you want to vector. And then require_once that from your LocalSettings.php
This way you inherit everything from vector and don't have to copy anything.
Perfect. I'd far rather override only where necessary, just didn't know where to start. Thank you, I'll try this.
Graham
mediawiki-l@lists.wikimedia.org