Mobile Wiki Skin

The next step in reviving my wiki was to make it accesible on my iPhone.  A quick trip through Google, and I found an answer on Stack Overflow. I installed the extension and the skin, and it worked – for the most part.  It did format the content nicely, but I saw the following error at the top of the page.

I haven’t done much with MediaWiki skins, but was hoping it wouldn’t be too hard to fix. So I searched my MediaWiki skins directory for the problematic function, and the following lines stood out:

$ grep -ir initPage skins
skins/Vector.php: public function initPage( OutputPage $out ) {
skins/Vector.php: parent::initPage( $out );
skins/WPtouch.php: function initPage( &$out ) {
skins/WPtouch.php: SkinTemplate::initPage( $out );

I changed WPtouch.php to make it consistent with Vector.php, and the error went away. Following is a diff of the before (top) & after:

< function initPage( &$out ) {
< SkinTemplate::initPage( $out );
> public function initPage( OutputPage $out ) {
> parent::initPage( $out );

I also changed the Display_Actions flag, to enable mobile edits (among other things).  It worked, but the Portrait mode needs a little tweaking:



It’s not pretty, but it seems to work fine in landscape mode, so I’ll leave it alone for now.  If you’re on a mobile device, you can see it here:

EDIT: I thought that there might be a newer version of the skin.  The Stack Overflow answer links to a 2010 page, but the mediawiki gallery links to a 2012 update.  I examined the download links and they seem to be the same.

Also, after posting my solution I got a reply from someone that had the same problem, and his solution to the “Actions” problem in portrait mode was to change the “Personal tools” text.  I changed mine to “My tools” (in ./languages/messages/MessagesEn.php), and that was enough to prevent Actions from wrapping onto the second line.

EDIT: In the years since I posted this, I have reinstalled MediaWiki without reapplying the changes above.


  1. Dan

    Wow, great find. Thank you for investigating and posting a fix. I’ve incorporated your changes into the latest bundle of the skin. Also, I may have figured out a way to support the older iPhone resolution when the “Actions” are enabled. If you don’t mind, let me know if it works better for you. It’s in the new ZIP file; I don’t have a working model of those generations to test on. It is a 320px portrait wide model you’re testing on, right? Thanks again.

  2. DAT

    I haven’t tried installing the update yet, but I wanted to mention that I was testing on an iPhone 5. I dug up my old iPhone 3G, which is 320px in portrait mode, and it didn’t look any different (at least in terms of spacing)

    I did download the update and compare it to my installed skin, and it looks like you missed one of the changes (the ampersand shown in the diff). I’d like to do more testing to verify the impact of that difference.

Leave a Reply

Your email address will not be published. Required fields are marked *