From n0r1sk software solutions
Revision as of 18:43, 18 February 2012 by Mario (talk | contribs)
Jump to: navigation, search

last edit 18.02.2012 by Mario

About notForMobile

notForMobile is a MediaWiki extension that adds a new tag:
<nfm> </nfm>
It is quite simple but very useful if your MediaWiki site uses a mobile skin like eg. WPtouch and you have the problem that some of your templates are breaking out of this skin on mobile devices.

Download and Installation

  1. Download a copy of the notForMobile.php file (right click -> save link as) to your MediaWiki extension directory.You can place it directly there our you can make a subfolder under the extensions directory.
  2. Afterwards, edit your LocalSettings.php file. You find it in the root of your MediaWiki installation. And add the following code at the bottom of the file.

<source lang="php">

  1. Not for mobile

require_once("$IP/extensions/notForMobile.php"); </source>

Now you can use the tags to mark your MediaWiki code to not be rendered on mobile devices:
<nfm>my text {{Template:MyTemplate}} </nfm>

Automatically switch to other skin for mobiles

Now you need to install a mobile skin like WPtouch. Add the following code to your LocalSettings.php to automatically switch to a mobile skin if a mobile browser renders your site. Be aware that you have to comment the default $wgDefaultSkin line!

<source lang="php">

    2. Default skin: you can change the default skin. Use the internal symbolic
    3. names, ie 'vector', 'monobook':

if (preg_match("/(mobile|webos|opera mini|Android)/i", $_SERVER['HTTP_USER_AGENT'])) {

   $wgDefaultSkin = 'wptouch';

} else {

   $wgDefaultSkin = 'monobook';

} </source>


GPL v. 2.0

This extension add a tag to MediaWiki to mark content which should not be rendered by mobile devices.

Copyright (C) 2011 by
        Christof Alber,
        Mario Kleinsasser,
        Markus Neuhold,
        Bernhard Rausch,
        Martin Steinwender

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.