Manual talk:How to make a MediaWiki skin

Jump to navigation Jump to search

About this board

Best way to reference images in skins, outside of stylesheets?

1
Samwilson (talkcontribs)

Is there a preferred way to create <img /> elements in PHP in skins? What's the best way to get the URL path to a skin's resources/images/foo.png file, for instance?

It looks like some skins use the $wgStylePath global, and some just include all images as CSS background-images. Maybe the latter is best practice. Should actual img elements be avoided?

Reply to "Best way to reference images in skins, outside of stylesheets?"
Nasirkhan (talkcontribs)

This page is a good starting point. But I will need some additional doc while customizing sections. I downloaded a skin form https://skins.wmflabs.org/#/add. On the template `ContentNamespaces.mustache` it contains the following line, how do I know what data it contains or how can i edit the list items?

{{#data-portlets.data-namespaces}}{{>Portlet}}{{/data-portlets.data-namespaces}}

Jdlrobson (talkcontribs)
Reply to "More advanced doc"

Adding a Stylesheet from an Extension to a Module of a Skin

5
DesignerThan (talkcontribs)
Jdlrobson (talkcontribs)
DesignerThan (talkcontribs)

I asked here, because I need some advice about the ResourceLoaderModules that is not specific to the mentioned skin or extension. I want to know if it is possible to add a ResourceLoaderModule Style depending on the used skin. I hoped it would be as easy as adding the wanted stylesheet to the ResourceModule of the Skin but sadly it isn't.

Sorry for the bad/general explanation at first. But maybe there is also a better place for that discussion.

Jdlrobson (talkcontribs)
DesignerThan (talkcontribs)

Thanks that was exactly what I needed.

Nasirkhan (talkcontribs)

I installed Mediawiki 1.35.1. Then I downloaded the Example skin from Github. I downloaded both the master branch (https://github.com/wikimedia/mediawiki-skins-Example) and REL1_35 branch (https://github.com/wikimedia/mediawiki-skins-Example/tree/REL1_35). After that i updated the LocalSettings.php and set $wgDefaultSkin = "example"; .


The sad part is I got a broken page looks like the CSS file is missing but I am sure there are other issues too.


Then I tried Option 2. Created a new skin form Skin Lab and enabled that. It did show in a way, but as I do not have and reference I am not sure if It was showing all the parts. But which I found that there are issues in JS because the special:preferences tabs were not working and I could not change the skin from the settings.


Can you please help to start building a new skin from scratch and provide a simple example skin which works! I will also need assistance on some advance area later but at the beginning I need a ground to stand upon.

Nasirkhan (talkcontribs)

@Jdlrobson As you have created this manual I believe you might help me to find some doc/ resource to follow and update/ build a skin.

Jdlrobson (talkcontribs)

> found that there are issues in JS because the special:preferences tabs were not working and I could not change the skin from the settings.


This sounds like an error with mediawiki, not your skin. Skins have no impact on preferences. Are there any JavaScript errors in your developer console? If not, are there any 500 server errors in your network tab suggestng problems serving the responses?

Jdlrobson (talkcontribs)
Nasirkhan (talkcontribs)

On the Vector skin special:preferences works and I changed the skin to New downloaded skin from SkinLab from Vector. But after that it stopped working.

There is no 500 error but on the console the error was the following

Uncaught SyntaxError: missing } after function body load.php:581:33

note: { opened at line 579, column 138 load.php:579:138


Example Skin Screenshot: https://user-images.githubusercontent.com/396987/104059751-fef70f00-521f-11eb-993d-1dc49a788f41.png

SkinLab Skin Preferences page: https://user-images.githubusercontent.com/396987/104059825-25b54580-5220-11eb-8ce9-d4507194d931.jpg

Jdlrobson (talkcontribs)

Yep, this was the issue I pointed to above (https://phabricator.wikimedia.org/T271441) I believe it should be in the latest 1.35 download now as it just got merged in the last hour.

If you want this to work with your current install, you'll need remove the features key in skin.json:

```

"features": {

                               "normalize": true,

                               "elements": true,

                               "content": true,

                               "interface": true,

                               "logo": true

                       },

```

Nasirkhan (talkcontribs)

I can download this new version. But where should I download this? The download page still shows the MediaWiki 1.35.1

Jdlrobson (talkcontribs)
Nasirkhan (talkcontribs)

I failed to get a working version again. I updated my mediawiki installation with the changes made in https://phabricator.wikimedia.org/T271441 and remove remove the features key in Example Skin. Tried the Skin Lab skin as well. But failed.

Can you please suggest me a way out from here?

Jdlrobson (talkcontribs)

Are you getting the same error or a different error now? Please see https://m.mediawiki.org/wiki/How_to_report_a_bug we'll be able to fix this much quicker if you are able to provide more information.

Tip: If its still the same error you add ?debug=true to the end of the URL you might get more specific errors. I'm also going to need to see the stack trace.

Nasirkhan (talkcontribs)
Jdlrobson (talkcontribs)

I think a lot of the friction here is because you are using the 1.35 release rather than 1.36/development branch and this guide was written on my poor assumption that developers would be using the development branch.

I've updated the page to make clear this is currently written with 1.36 in mind, while working out how to improve things in future.


While I'm sorry your own experience is proving frustrating, this is helping people who try this out in future, so thank you.

Nasirkhan (talkcontribs)

1.35 and 1.36 is same from my end as I needed a working version of a MediaWiki. As I do not contribute and update the projects version to version I thought it is safe to use a stable release. Dev versions may have issues in the core, which might take time to fix and will create blocks to my original objective of creating a new skin. But now I know stable release is not stable at all!

If you would say earlier to use 1.36, I will continue using that, as the plan of creating/ updating existing is to make it ready for the future versions. But again if I was doing a real project I would use the 1.35 and the project would be a complete failure.

Now I will try with 1.36/development release. Let see what is there for me.

Nasirkhan (talkcontribs)

MediaWiki 1.36.0-alpha installation failed

I followed the following steps till I failed.

  1. Run git clone --depth 1 https://gerrit.wikimedia.org/r/mediawiki/core.git to download the dev version. Found a notice that external packages needed to be downloaded.
  2. I ran composer update and found that it requires composer 1 and downloaded that from the site.
  3. Now I run php composer.phar update --no-dev and then it installed all packages successfully.
  4. But when the Mediawiki installation page came it looks like the following: https://user-images.githubusercontent.com/396987/104172208-1277c500-542e-11eb-97fb-66917b94c73c.jpg

Before getting the error I did not know that it requires Composer 1. As composer recommends to use v2, it should be mentioned somewhere in the doc.

Can you please suggest me how to install MediaWiki 1.36.0-alpha?

Nasirkhan (talkcontribs)
Reply to "Getting started Failed!`"
There are no older topics