SMF4iPhone
For SMF 2.0 RC2, 2.0 RC3 and 2.0 RC4

Author: Fabius
Co-author: butchs

Based on: FarFromPerfection SMF4iPhone Theme and Mod

Special Thanks to: Movila Ltd for DetectFree service and API

*Install Instructions*
1. Install smf4iphone_theme.zip as a theme and follow theme instructions
2. Install smf4iphone_mod.zip as a package and follow mod instructions



SMF4iPhone Theme

*Customization*
To change the header logo, replace logo.jpg in the theme images folder.

If you want to translate the theme, follow these instuctions:
- Make a copy of "iPhone.language.english.php", "iPhone.language.english-utf8.php", "Settings.english.php", "Settings.english-utf8.php".
- Rename files replacing english with yourlanguage.
- Translate all the strings.

If you want your translation to be officially added to the theme, send it to fabius85@gmail.com.

*Supported Languages* *Changelog*
- 1.1   (26/11/2010) - 1.0   (09/04/2010)


SMF4iPhone Mod

*Summary*
The mod uses the Movila Free Device Detection which is a free server that detects wether or not you are using a mobile device. This service takes some of the problems out of the picture. It will check the user agent and also the domain names that are used for mobile devices.

After the mobile device is detected, filters defined in "Admin > Configuration > Modification Settings > SMF4iPhone" are used to send a specified user agent to one of previously set themes. If a user agent is not found, the mobile device will go to the failsafe such as wap2 or a theme you specify.

*Features Of This Mod*
*Customization*
If you want to translate the mod, you just need to translate the following lines and add them the the end of the respective files.

Modifications.yourlanguage.php or Modifications.yourlanguage-utf8.php:


Errors.yourlanguage.php or Errors.yourlanguage-utf8.php:


If you want your translation to be officially added to the mod, send it to fabius85@gmail.com.

*Supported Languages*
*Usage*
The mod can transfer to SMF4iPhone Theme, Curve Mobile, Mobile Theme, or any other theme, basing on the phrases entered in the Modification Settings. It is suggested that you copy the built in phrases. Save them to a safe place and give it a try. If everything works right you should be able to send someone to any theme based on the phrases. Adding a new User Agent is as simple as typing in a new phrase using the proper syntax.

If you have "smf4iphone_theme", "curve-mobile" and "mobile_theme" installed before you load the mod, it will automatically detect the theme IDs and assign them as follows:

Theme # 1:           smf4iphone_theme
with user agents for
  iphone|ipod|android|mobile|Safari Mobile
Theme # 2:           curve-mobile
with user agents for
  iemobile|Opera Mobi|symbian|series60|series70|series80|series90|series 60|series 70|series 80|series 90|blackberry|blackberry05|palm|webos
Theme # 3:           mobile_theme
with user agents for
  nokia|motorola|samsung|fennec|minimo|sonyericsson|htc
Failsafe Theme:  wap2
all remaining user agents

Phrases must be entered in the format of "user agent|user agent" ie "safari|firefox". Mobile failsafe can be "wap", "wap2", "imode" or "theme=#" where # is the ID of the theme. Theme will not load unless both ID and phrases have data.

If any of the above themes are missing the mod will leave the theme ID blank. If either row is blank the theme will be skipped. The selection boxes are text boxes so be careful. A trailing space in theme ID will skip that theme. Please note that the user agents selected are merely a guess and should be adjusted for the theme best fit.

The mod works both if using SMF caching system or not. If you don't want to use this support, enable "Skip cache errors" option in Modification Settings to prevent your logs from being filled of cache errors.

*Other Themes*
To add a link to this or another theme type http://www.yoursite.com/smf/index.php?theme=#
Where # is your theme ID.

Or you can modify your default theme with a selection at the bottom of index.template.php next to wap2. Something like:
  <a href="http://www.yoursite.com/smf/index.php?theme=' . $modSettings['id_theme1'] . '>iPhone Theme</a>

*Warnings*
VERY IMPORTANT IF YOU DON'T WANT PHP TO CRASH :
    a) In Theme Management, select : 'Allow members to select their own themes.'
    b) Select SMF4iPhone Theme.

    If you don't do that, when surfing on iPhone, the forum will try forever to use the forbidden to use by force the iPhone theme, and the system will loop until crash.

COOKIES MUST BE ENABLED BY USERS FOR THIS MOD TO WORK
*Known Issues & Things To Do*
Use of DetectFree service is limited to the duration that it is offered. If the service is turned off this mod will not work.
The phrases must have a certain syntax. A future version may simplify the syntax.

*Changelog*
- 1.1   (26/11/2010) - 1.0   (09/04/2010)