The Mobile Content Switch Plugin is a free Joomla Plugin that will enable you to hide or show content depending if the user is visiting your site from an iPad, iPhone, iPod Touch, or not.
Great to display an embedded Flash video for non-Apple mobile devices, and a QuickTime movie for Apple mobile devices, or other such uses.
(Thanks to Peter van Westen from www.nonumber.nl for the help with regex)
Usage:
{ipad}Display content to visitors ON an iPad.{/ipad}{noipad}Display content to visitors NOT on an iPad{/noipad}{iphone}Display content to visitors ON an iPhone or iPod touch.{/iphone}{noiphone}Display content to visitors NOT on an iPhone or iPod touch.{/noiphone}{applemobile}Display content to visitors in EITHER an iPad, an iPod, or an iPhone{/applemobile}{noapplemobile}Display content to visitors in NEITHER an iPad, an iPod, or an iPhone{/applemobile}
Important Notes: (updated June 6, 2010)
- Set in Global Configuration > Systems > Cache = no for the plugin to work, otherwise what you will see is the cached version of the article, which may have been generated by a device other than the one you are viewing the article on.
- If you have caching enabled, and your content is in a module, make sure to set the module not to be cached (advanced parameters > caching)
- If you use the plugin in a module, make sure that the module is capable of running plugins (such as mod_placehere)
Changelog
Version 1.6 - June 16, 2010
- Resolved an issue with iPhone compatibility
- To upgrade, unzip the plugin and copy the mobilecontentswitch.php and mobilecontentswitch.xml files to /plugins/content
Download the Mobile Content Switch Plugin for Joomla
Found the plugin useful?
All proceeds will be donated to Words of Peace Global
This entry was posted
on Wednesday, April 7th, 2010 at 6:06 pm and is filed under php.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.

Cool, thanks!
Great idea. I just ran a test and noapplemobile works, as does iphone specivid.
But when I try to use applemobile as a catchall for iphone and ipad it goes wrong and shows the noapplemobile content.
I am only testing on iphone as I don’t have an ipad.
Great idea, what would be ideal (for me anyway) would be a way with the plugin to hide module positions. If I didn’t want the right or left menu areas to display, I could just select them in the plugin. It would pull all of the module positions from the template itself since many of the newer templates add new positions.
You can do this by tweaking your template’s index.php.
For example:
countModules(’mymodule’) && strstr($_SERVER['HTTP_USER_AGENT'],’iPad’);) : ?>
Hi Jossi
Can you give us more examples on how to tweak the index.php — such as for both ipod and ipad. Or would iPad handle all possibilities
Thanks,
Rowby
For example, could you give us a complete rewrite of the following example that I have in my template to handle the iPad and Ipod
countModules(’banner’)) : ?>
Thanks!
Hmmmmm the comment system stripped out most of my code example.
Perhaps you can add very specific examples in your useage section of this page tos howhow to handle modules.
Thanks!
Just the same as Don, works great with iphone tag but not with applemobile…
Could it be fixed ?
Hi, just the same as Don, works perfect with the iphone tag but not with the applemobile one ?
SHould I use {ipad}{iphone}{/iphone]{/ipad} ?
Having the same issues as Don.
I have an iPhone and an iPad…
using {applemobile} doesn’t show the content on an iphone…
any help would be appreciated
Hi, the plugin is very helpful but it seems doesn’t work perfectly.
By using the code
{applemobile}testapple{/applemobile}
{noapplemobile}testnoapple{/noapplemobile}
the results are:
on laptop “testnoapple” (correct!)
on iPhone “testnoapple” (incorrect!)
I need your help to solve the problem…
Thank you very much in advance.
Andrea
@Andrea, Rod and Jerome
Please note that you have to set in Global Configuration > Systems > Cache = no
for the plugin to work, otherwise what you will see is the cached version of the article, which may have been generated by a device other than the one you are viewing the article on.
If you have the content on a module,, make sure that the module is capable of running plugins (such as mod_placehere)
If you have caching enabled, and your content is in a module, make sure to set the module not to be cached (advanced parameters > caching)
Dear Jossi, thank you very much for your answer.
I have just checked the system configuration, and the cache is already set on “no”.
In my case I would like to use the plugin directly in an article: here’s the test code:
{applemobile}applemobile{/applemobile}
{noapplemobile}noapplemobile{/noapplemobile}
and you can test by yourself here:
http://www.milestonesrl.tv/index.php?option=com_content&view=article&id=97&Itemid=233
If I open the page by PC, it works fine (noapplemobile label appears).
If I open the page by iPhone, there is an error (noapplemobile label appears too).
If I open the page by iPad, it works fine (applemobile label appears).
So the problem seems to be with iPhone only.
This plugin is very important for me and I need your support: I’m ready to donate a good amount if you can help me. My e-mail is webmaster@milestonesrl.com
Thank you in advance.
Andrea
Hi Andrea, I am making some adjustments and will upload a new version today.
Thank you for your feedback!
New version 1.6 available, resolving the iPhone compatibility issue reported.
Enjoy!
Hi, great plugin!
Quick question, I have an older Joomla 1.0 site…do you know if I can use the plugin on 1.0?
Thanks!
@ Chris w
You can certainly give it a try.