Simple mobile skin auto change

Although there is presently an ext-mobskin>Extension:MobileSkin|extension designed to automatically change to various mobile skins (iPhone, Blackberry, etc), it doesn't work with the current version of MediaWiki (as of 08-09-2010).

The following code snippet (added to LocalSettings.php) allows for detection of an iPhone, followed by automatic switching of the skin / theme to an iPhone-compatible one (in this case, wptouch>Special:MyLanguage/Manual:Gallery of user styles#WPtouch|WPtouch).

Add this code to your  file (replacing the current  variable) after installing the iPhone-compatible skin.

This will make the default skin "wptouch" if an iPhone, "vector" otherwise. Modify as needed. If file cache is enabled you may need to disable it to prevent visitors from seeing the wrong skin.

If a user logs in, their skin preference overrides this setting.