
Version
Rating
Compatibility
Votes
License
Views
Date Added
Developer
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
No comments:
Post a Comment