Extension:MobileFrontend

Installation

 * 1) Copy the files from the SVN repository to your server (see the "Download" links in the sidebox).
 * 2) Add this link to the bottom of LocalSettings.php:

Configuration settings
The following variables can be defined in LocalSettings.php after calling require_once("$IP/extensions/MobileFrontend/MobileFrontend.php"):

Homepage
By default, the only content that a user will see on their project homepage is search, license, and action control. In order to see content you have to use the appropriate css selectors. See http://meta.wikimedia.org/wiki/Mobile_Projects/Mobile_Gateway#Mobile_homepage

More information
If you would like to test the mobile extension on a desktop browser or your device doesn't render the mobile version you can append the following key-value pair to the querystring: useFormat=mobile e.g., http://nomad.tesla.usability.wikimedia.org/index.php/Eby_J._Jose?useformat=mobile

If you would like to see the wap version of the mobile extension use: ?useFormat=mobile-wap instead.





Legacy API
Currently, MobileFrontend has an ad-hoc API available through the main entry point. If you add a &format=json you will get back a document that has the following sections


 * title ~ Page title
 * html ~ HTML body

ex. http://en.wikipedia.org/wiki/Main_Page?useformat=mobile&format=json {   "title": "Main Page", "html":" Today's featured article<\/h2> \n <\/img><\/a> <\/div>\n Tom Driberg<\/a><\/b> (1905\u20131976) was a British journalist and politician who was a Labour Party<\/a> Member of Parliament<\/a> between 1942 and 1974. ....

New API
The new API currently under development does the following:

Extended action=parse
action=parse receives the following extra parameters:
 * mobileformat={html|wml}: Return rendered page in a mobile format, HTML for modern phones or WML for dumb phones.
 * noimages</tt>: Disable images in mobile output.
 * mainpage</tt>: Apply mobile main page transformations.

Example:

api.php?action=parse&page=Main_Page&mobileformat=html&prop=text&format=json

 {	"parse": { "title": "Main Page", "text": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\">\n<?xml encoding=\"UTF-8\"?>\n <div id=\"content\"> This is a <a href=\"http:\/\/www.mediawiki.org\/wiki\/Extension:GeoData\" class=\"extiw\" title=\"mediawikiwiki:Extension:GeoData\">GeoData<\/a> test wiki. . . . </tt>

prop=excerpt
Returns article excerpts - text representation of ledes. Two formats are available: cleaned up HTML and plain text. Parameters:


 * length</tt>: Length of excerpts. If this parameter is omitted, all text until the first section heading will be returned.
 * limit</tt>: Maximum number of excerpts to return. Because excerpts generation can be slow, the limit is capped at 10 (20 for users with apihighlimits</tt> permission).
 * plaintext</tt>: Return plain-text excerpts.
 * continue</tt>: When more results are available, use this parameter to continue.

Example:

api.php?action=query&prop=excerpt&exlength=100&titles=Earth&format=json