Auto Template Switcher for iPhone 
Version
1.0.1 (last update on Sep 24, 2008)
Rating
Compatibility
Votes
2
Favoured
18
License
GPLv2.0
Non-Commercial
Type
Views
4030
For 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)
Released September 23, 2008
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.
Demo
====
To see the module in action,
1) Install the module
2) Publish it in a module position in your home page.
If you are using the standard Joomla installation with the standard templates, you can just try loading the home page using Mozilla, IE and iPhone. You will see your home page displayed in different templates.
If you have your customized templates, go to Modules Manager and
* Set the detect string for browser 1, 2 and 3
* Set the corresponding template for browser 1, 2 and 3
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) AppleWebKit/525.18.1(KHTML, like Gecko) Version/3.1.1 Mobile/5A345 Safari/525.20
The program uses preg_match(), so you only need to use a string in $_SERVER['HTTP_USER_AGENT'] that uniquely identifies the browser you want to identify. For this case, the detect string can be as simple as "iPhone".
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
Browser 2: MSIE
Browser 3: Mozilla
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.
browser1 = iPhone => template1 = beez
browser2 = MSIE => template1 = beez
browser3 = Mozilla => template1 = rhuk_milkyway
default browser => template = rhuk_milkyway
The default browser is used when there's no match against browser 1, browser 2 or browser 3.
Making the template invisible
=============================
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
===============
* Allow you to detect up to three different types of browsers (user agents).
* Auto switching of templates based on the type of browsers.
* A default template for use with all other browsers.
Related Plugins
===============
GoogleSearch component/module
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,4903/Itemid,35/
This component allows you to add Google Adsense Search to your Joomla site. The search results are displayed RIGHT INSIDE your Joomla page!
GoogleAds
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,5022/Itemid,35/
This plugin allows you to display Google Ads right inside your content pages.
DirectPHP
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,4470/Itemid,35/
This plugin allows direct embedding of PHP commands right inside Joomla content page.
Include Content Item Plugin
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,4809/Itemid,35/
This plugin allows you to insert or include one content item into another content item.
Google Image Search: This Google Image Search component / module pair allows you to add Google Image Search to your Joomla site. The search results are displayed right inside your Joomla page!
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,5654/Itemid,35/
Google News Search
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,5686/Itemid,35/
The Google News Search component / module pair allows you to add Google News Search to your Joomla site. The search results are displayed right inside your Joomla page!
Wikipedia Search
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,5705/Itemid,35/
This Wikipedia Search component / module pair allows you to add Wikipedia Search to your Joomla site. The search results are displayed right inside your Joomla page!
Google Video Search
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,5733/Itemid,35/
This Google Video Search component / module pair allows you to add Google Video Search to your Joomla site.
Google Book Search
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,5787/Itemid,35/
This Google Book Search component / module pair allows you to add Google Book Search to your Joomla site.
Google Currency Converter - AJAX version
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,5795/Itemid,35/
This module allows you to add the Google Currency Converter (from Google Finance) in a module position. AJAX is used, so no reloading of pages is required! Since this is a standard Joomla module, you can easily include this module into a content item or article with the use of {loadposition}.
Yahoo Currency Converter - AJAX version
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,5815/Itemid,35/
This module allows you to add the Yahoo Currency Converter (from Yahoo Finance) in a module position. AJAX is used, so no reloading of pages is required! Since this is a standard Joomla module, you can easily include this module into a content item or article with the use of {loadposition}.
Yahoo Stock Quote - AJAX version
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,5907/Itemid,35/
This module allows you to display stock quotes from Yahoo Finance in a module position. * Retrieves "real-time" stock quotes through Yahoo Finance API. * Uses AJAX to display the result - no reloading of pages required! * Automatic refresh of the latest stock quotes at user-defined interval.
byinstantinlaw on September 9, 2008
This module has saved me a ton of work. Because of Internet explorer’s non standard rendering of web content, the image in the header of my template did not show properly in its z-index.
Using KKsou's module allows me to keep the same design for both (FF & IE) browsers, but change the header image for each. It’s also a plus that I can also include 2 more templates in the mix if I need them.
KKsou went above and beyond in his support of this module when it did not work right out of the box. He responded to my forum post the same night and even emailed me. After checking a couple of things he realized that he forgot to include an instruction to edit application.php in the Joomla core and once I did that it worked perfectly. I am very grateful to KKsou for his commitment to producing high quality Joomla add-ons and I can't wait to try some of his other offerings.
Using KKsou's module allows me to keep the same design for both (FF & IE) browsers, but change the header image for each. It’s also a plus that I can also include 2 more templates in the mix if I need them.
KKsou went above and beyond in his support of this module when it did not work right out of the box. He responded to my forum post the same night and even emailed me. After checking a couple of things he realized that he forgot to include an instruction to edit application.php in the Joomla core and once I did that it worked perfectly. I am very grateful to KKsou for his commitment to producing high quality Joomla add-ons and I can't wait to try some of his other offerings.







