NotForMobile
From n0r1sk software solutions
Contents |
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.
MediaWiki Link
You can find the MediaWiki page of this extension here
Download and Installation
- Download a copy of the notForMobile.php file (right click -> save link as) to your MediaWiki extension directory. You can place it directly there or you can make a subfolder in the extensions directory.
- The extension surrounds the html output with an div class css tag.
<div class="notForMobile"> </div>
- Add a corresponding markup to your mobile skin css file. This will prevent mobile browsers that are using the mobile skin from rendering this div.
div.notForMobile { display:none; }
- Afterwards, edit your LocalSettings.php file. You'll find it in the root of your MediaWiki installation. Add the following code at the bottom of the file.
#Not for mobile require_once("$IP/extensions/notForMobile.php");
- 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!
## EDITED BY MARIO## Default skin: you can change the default skin. Use the internal symbolic## names, ie 'vector', 'monobook':if (preg_match("/(mobile|webos|opera mini|Android)/i", $_SERVER['HTTP_USER_AGENT'])) {
$wgDefaultSkin = 'wptouch';
} else {
$wgDefaultSkin = 'monobook';
}
License
This extension add a tag to MediaWiki to mark content which should not be rendered by mobile devices.
Copyright (C) 2011 by
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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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.
last edit 14.03.2013 by Bernhard



