Auto Template Switcher for iPhone |
| Written by kksou | |||||||||||||||||
| Monday, 01 September 2008 | |||||||||||||||||
|
This module allows you to automatically switch to a different template just for iPhone or iPod users. Table of ContentsFor all other users using standard browsers (e.g. Mozilla, IE, Safari), they will see your default template. I designed this initially to serve different templates for iPhone/iPod users. But you can use this for other browsers too, for example, if you wish to serve different templates for iMac, Windows and Linux users. Important for Joomla 1.5 users !!! You need to change one line in the Joomla core for this to work. In file /includes/application.php in function getTemplate (around line 281), change the line if ($template = $this->get('setTemplate')) {
to this one if ($template = $this->getUserState('setTemplate')) {
Latest Version v1.01 (for Joomla 1.0) and v1.51 (for Joomla 1.5) In addition to switching template on different user agents, you can now also specify the inital designated page that will be displayed when a template-switch occurs. For example, you can automatically redirect an iPhone user to a dedicated iPhone home page when he or she comes to your site. You can specify different url page corresponding to each template and user agent in the parameters page of the Module Manager. Note that a redirect to the designated page will only occur when there's a template switch. If there's no swtich of template, there will be no redirect to the page. Thanks to Wayne Geddings for suggesting the above enhancement. How it works?The module uses $_SERVER['HTTP_USER_AGENT']to detect user's browser. For example, the value returned by iPhone is: Mozilla/5.0 (iPhone; U; CPU iPhone OS 2_0 like Mac OS X; en-us) The program uses The module allows you to specify up to 3 different browser user agents. For example, when you first installed the "Auto Template Switcher" module, the default settings are as follows: Browser 1: iPhone For each browser, you specify the corresponding templates. The following shows the default settings when the module is first installed. The templates are those that come bundled with standard Joomla installation.
The default browser is used when there's no match against browser 1, browser 2 or browser 3. Note that the auto-switching of the template is achieved through the use of module. The only purpose of the module is to detect the user agent and auto switch the template. It does not display anything. So if you set "Show Title" to "No", the module will be invisible. Unique Features
DownloadHow to install
|
|||||||||||||||||
| Last Updated ( Monday, 01 September 2008 ) | |||||||||||||||||
| < Prev | Next > |
|---|





Comments
Can I change the template according to the user group?
Tanks
If you know PHP, almost anything is possible. You just need to code it.
For this module, as the name suggests, it just serve one simple purpose: to switch to a different template when you detect a user using iPhone.
I didn't code any other thing, so it won't respond to different user groups.
You might want to check the joomla.org to see if there's any plugin or module that achieve what you have in mind.
Regards,
/kksou
¿Could I use your program to backberry?
Use $_SERVER ['HTTP_USER_AGENT '] to find out the appropriate user agent string and you should be able to use it.
Please refer to the section "How it works?" above.
Regards,
/kksou
Don't think so.
Sorry, still don't have the time to convert this for Joomla 2.5...
Regards,
/kksou
RSS feed for comments to this post