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
DownloadNote: Due to the recent "warning" from my host that my site's CPU usage is too high, I have to resort to a more primitive method of downloading that does not take up much CPU resource. (The original AJAX version uses too much CPU and mysql resources.) As javascript is used, you have to enable javascript to download the files. Thank you for your understanding. Joomla 1.0.x: autotemplateswitcher_v1.01.zipJoomla 1.5.x: autotemplateswitcher_v1.51.zip How to install
User reviews Average user ratings: 3.5 (from 14 users) Note: You have to be a registered member to leave a comment. Free registration here. |
|||||||||||||||||
| Last Updated ( Monday, 01 September 2008 ) | |||||||||||||||||
| < Prev | Next > |
|---|
Joomla 1.0 Articles
- How to create a module with DirectPHP plugin?
- How to include modules in Content item?
- How to include modules in Section/Content Description
- How to include PHP commands in Section/Content Description
- How to make plugins process Section/Category descriptions
- Include Code Listing plugin - More Tips and Techniques
- How to have DirectPHP plugin process RSS feed?
- How to have the plugins processed when genrating PDF documents of content items?
- How to have DirectPHP commands processed in Joomla search?
Joomla 1.5 Articles
- How to create a module with DirectPHP plugin?
- How to include modules in Content item?
- How to include modules in Section/Content Description
- How to include PHP commands in Section/Content Description
- How to make plugins process Section/Category descriptions
- Include Code Listing plugin - More Tips and Techniques
- How to have DirectPHP plugin process RSS feed?
- How to have the plugins processed when genrating PDF documents of content items?
- How to have DirectPHP commands processed in Joomla search?
Joomla Plugins
Joomla Components
Joomla Gadgets
- Google Image Search
- Google News Search
- Wikipedia Search
- Google Book Search
- Google Video Search
- Google Currency Converter - AJAX version
- Yahoo Currency Converter - AJAX version
- Yahoo Stock Quote (AJAX module version)
- Yahoo Stock Quote (AJAX component/ module version)
- googleSearch_cse component
- googleSearch_cse module
- googleMaps plugin








3.5 (from 14 users)
September 18, 2008 10:07pm
The perfect extension would be a plugin that sent any mobile visitor to the designated Home Mobile page and adjusted for the browser (IE, Firefox, Google Chrome, etc.
September 23, 2008 11:44pm
Hi Wayne,
Please try the latest version v1.01 (for Joomla 1.0) and v1.51 (for Joomla 1.5).
I've incorporated this feature into the new version i.e. you can now specify the inital designated page that will be displayed when a template-switch occurs
Regards,
/kksou
September 27, 2008 7:00am
I use jomla 1 , after 2 hours can't manage to make it work, install was fine, module is publish, can't find why it's not working www.api4.me/joomla/ thanks for helping
September 27, 2008 7:37am
If I publish the module, the site doesn't work at all anymore
September 27, 2008 8:43am
What's the error message that you get? Please provide some details so that we have some clues as to what might have happened.
1. Can you please try on a fresh install of Joomla first. Did it work?
Try this first so that at least you'll know if it works on your machine.
2. If (1) works, try it on your other site that you said didn't work. Please list the entries that you've entered in the parameters page. e.g. user_agent1=?, template1=?, user_agent2=?, template2=?, etc. Please also list the names of the folders in the folder /templates
Regards,
/kksou
September 27, 2008 11:45pm
thanks for the answer
here it is http://www.api4.me/joomla/switcher.jpg
this was done on a fresh install of joomla, i don't have any error message, the template just doesnt switch on IE,fox or Iphone
I will try reinstalling a new version of joomla
thanks for the help
November 25, 2008 8:25am
Very Interested in this but click download and states 'invalid link'
November 25, 2008 10:25am
Download Link - now working, Thanks.
December 19, 2008 10:53pm
Sorry I tried installing this, however it only showed my iPhone template to ALL browsers. I un-installed it and now I have lost my default template altogether. My site is now only showing NO template and I can't get it back! Any ideas?
March 27, 2009 3:56am
I was really exited when I found this module so I install it on my website (joomla 1.5) and it worked great, but when I tried to browse around the site on my computer I found out that template is broken. My template has 4 colors styles and I choose to show color style #2(orange), when I open the site on my comp it shows color #2 but when any link is clicked template is changed to style #1(red default). that happens when search site is used only. I tried to uninstall module but template left broken. I tried also to install module on subdomain fresh joomla installed only Auto Template Switcher module installed, same template installed and the same problem occurred.
I also found out when I turn SEO Off + .htaccess into htaccess.txt everything works great.
How can I solve this? this all started after Auto Template Switcher installation
May 31, 2009 5:16pm
I've installed and have a question. From an iPhone, I'd like to goto a specific page on my website instead of the home page. So, my URL looks like "www.site.com/iphone-app2". The homepage keeps coming up. Is there a setting or a fix for this? Can I do this?
Thanks.
August 17, 2009 7:17am
Great idea to build a module for iPhone users. Unfortnunately when I edit the application.php (in includes folder), the normal browsers become blank (text only) because they are without a template. Only the iPhone browser assigned a template to itself.
So I can't use it. :-(
August 25, 2009 4:41am
Iphone browser detection works but other browthers get blank template instead of the specified one...
using joomla 1.5.14(hacked in application.php) + ThemeForest NewsPressed mobile iphone template + a yootheme one for other browsers
August 31, 2009 10:29am
Hi KKSOU,
There seems to be a problem with setting the default page using the URL field. Despite setting this URL, I keep having the default homepage of my website being displayed.
I have tried emlptying the cahe but it does not solve the problem.
Do you have any clue ?
Thanks in advance