screen-shot-2010-04-08-at-70411-pm

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{/noapplemobile}
  • {android}Display content to visitors on an Android device{/android}
  • {blackberry}Display content to visitors on an BlackBerry{/blackberry}
  • {palm}Display content to visitors on an PalmOS device{/palm}
  • {sonyericsson}Display content to visitors on an SonyEricsson (Nokia) device{/sonyericsson}
  • {symbian}Display content to visitors on an SymbianOS device{/symbian}

joomla_commpow_sm

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 2.1 – August 11, 2011

  • Support for Joomla 1.6 (Thanks to Louis Carlos)
  • Added {mobile}{/mobile} {nomobile}{/nomobile} parameters (Thanks to @Mano)

Version 1.7 – January 29, 2011

  • Added support for Android, Palm, Blackbery, Symbian, Palm, and Sony Ericsson

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 1.5

Download the Mobile Content Switch Plugin for Joomla 1.6

Found the plugin useful?

All proceeds will be donated to Words of Peace Global

92 thoughts on “Mobile Content Switch Plugin for Joomla

  1. I cant see the changes for mobile/nomobile in the version (2.0) I downloaded. Is that correct or am I missing something?

  2. @Paul: what tags did you use?

    Also, please read note:

    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)

  3. Hi Jossi,

    I have just installed the plugin. Set the cache system to no. Edit a new content article with:
    a video code with flash and the tag noapplemobile
    a video mp4 with the tag applemobile
    The plugin is active.
    From a PC I can see only the video with flash which is correct. From a ipad 1 and a iPhone3 I can only see the logo Adobe Flash.
    I tried with the tag iPad : same thing.
    No cache, no module, plugin active, tag at the beginning and at the end with a /, Joomla 1.53, new article (no cache problem) but still not working.
    What is your diagnosis ?

  4. Are you using the version for Joomla 1.5 or 1.6?

    Can you try on a test page the following?
    {applemobile}I am viewing this in an Apple iOS device{/applemobile}
    {ipad}I am viewing this in an iPad{/ipad}
    {iphone}I am viewing this in an iPhone{/ipad}
    {noapplemobile}I am viewing this in an device that is not an Apple iOS device{/noapplemobile}

  5. I am trying to install the Mobile Content Switch Plugin but the error “Error! Could not find an XML setup file in the package.” appear. What is the problem? Please help.

    I am using Joomla 1.5.7

    Thank you in advance.

  6. @Sam – Maybe something wrong with the zip file? I suggest you unzip the package and zip again, Then try to install it again.

  7. Great plugin !
    But is there a way to transform it into a system plugin instead of a content plugin ?
    Because as it’s a content plugin it isn’t executed in rss feeds for example or in components, so if you use joomlatags for example you’ll see {noapplemobile}{/noapplemobile}{applemobile}{/applemobile} :
    http://www.360images.fr/chateau.html

    thanx !

  8. Excellent plugin!!!

    But I would like it to have a {noblackberry} option, as my site is on Joomla 1.5.23 and I can’t use {nomobile}

    Thanks.

  9. @Liber:
    Open mobilecontentswitch.php and replace lines 65 to 73 with this:

    if ($blackberry) {

    $row->text = preg_replace( "#\{blackberry\}(.*?)\{/blackberry\}#s", '\1', $row->text ); // removes just the {blackberry} tags from content for blackberry devices
    $row->text = preg_replace( "#\{noblackberry\}(.*?)\{/noblackberry\}#s", '', $row->text ); // removes {noblackberry} tags + content for no blackberry content

    } elseif (!$blackberry) {

    $row->text = preg_replace( "#\{blackberry\}(.*?)\{/blackberry\}#s", '', $row->text ); // removes {blackberry} tags + content for non blackberry devices
    $row->text = preg_replace( "#\{noblackberry\}(.*?)\{/noblackberry\}#s", '\1', $row->text ); // removes just the {noblackberry} tags from content

    }

  10. I’m in the process of building a new 1.7 site, almost didn’t download this until I read through these comments… might want to update the Joomla extensions library indicators. It currently only shows compatibility with 1.5 and 1.6

  11. Hello!
    Plugin looks really greate!

    But I am curious, could I use this plugin together with “Mobile Joomla!” component, and will it switch between content for the same range of mobile phones as “Mobile Joomla!” supports? Or may be there is a posibility to show an additional content depending on the template usin f.e. list of mobile and non-mobile templates?

    Thank you in advance
    Vladimir

  12. This plugin is fantastic. It should be in the core of joomla since it serves up a very needed feature: a way to show different content specifically made for mobile devices while the desktop content remains untouched. Thank you for writing this I hope you’ll continue to update it for future versions of joomla its really needed

  13. I really enjoy your plugin! I’m having a little trouble making it work in HWDRevenueShare. I’m trying to hide banners on the video pages, but it’s still loading them. It’s showing the {noiphone}{/noiphone} tag around the banner.

    Thoughts?

  14. No, I don’t. I’m guessing that the component is not recognizing system plugins within it. That being the issue. I even went in and tried to place the tags in the template file with no luck.

    By the way, is there a way to be notified when you post a response?

    Thanks!

  15. I do not have cache enabled. I’m sure it’s because the component isn’t accepting the plugin tags.

    I even tried editing the template files to not load that module position with the tags, but with no change.

    BTW – is there any way that I can get a notification when a response is posted here?

    Thanks!

  16. If you are using the plugin in a module, make sure that the module is capable to execute plugins.

  17. hi jossi, thank you for the plugin ;) – it´s super. but i have a problem with tweaking the template. i want at first hide the modul with the name sfh-home for desktop users.

    i have no php knowlege: i have pasted this in my index.php

    But with this code i can see with the desktop pc the module? Is the pasted code wrong??

    PS: (((this is before the pasted code: …
    and this is behind:
    …)))

  18. HI Jose

    I would be really interested in a 2.5 version. I use the mobileJoomla extention as well, but I use a flash Gallery which doesn’t work on Apple devices, and this seems the ideal answer.

  19. Dear Jose,
    in my web I have the component Oyiogallery, for Joomla 1.5
    My problem: this flash don’t work in Iphone, Ipad,
    Can you please, tell me, how to make to execute your fantastic pluging on my video/flash ebsite?
    The Ozioflashgallerie i have in article and pluging-in-module

    Thanks

  20. Mobile content switch not working in mobile joomla? I’m trying to use the plugin on my mobile joomla site but it just outputs the tags instead of processing them. It shows the tags on the frontend like this:

    {nomobile}

    my content

    {/nomobile}

    {mobile}
    mobile content here
    {/mobile}

    Any ideas on why this wouldn’t be working in the mobile joomla component?

  21. By the way Im using it on joomla 1.7 and its happening on the desktop side too I didn’t notice that before.

  22. one other thing i forgot to mention sorry im trying to use the plugin inside of a redshop category template.

  23. I try to use the new version that has added the {mobile}(/nomobile) in a jommla 1.5 version? Is it possible to get a 1.5 version

  24. I’m really new to Joomla and even newer to using extensions & plug ins.. I don’t understand how to use your plug in at all.. I do have it installed, enabled and set I do have Cache = no set.. But besides that I don’t understand how to use it.

    Thanks

  25. Hi, thanks for such an awesome extension. please when is the updated version for joomla 1.7 coming?

  26. Love the plug in. I see in several of your responses that if we’re using it in a module, we have to make sure the module can execute plugins. How do we do that? For instance, it works fine in my articles, but in my banner modules, I want to make sure that it’s using a smaller version of the banner on mobile devices. I try to include the tags in the banner but it doesn’t work. I tried downloading the plugin place_here that you recommended, but it has such poor documentation, I can’t figure out how to make it work. Thanks for your help.

  27. Hi there, pardon my complete ignorance… but I cannot seem to figure out how to apply this to a menu? Can anyone please set me straight? Thx so much!

  28. Nice post. I was checking constantly this blog and I’m impressed! Extremely helpful info particularly the last part :) I care for such info a lot. I was looking for this particular information for a very long time. Thank you and good luck.

  29. These are in fact impressive ideas in on the topic of
    blogging. You have touched some fastidious points here. Any way keep up wrinting.

  30. Have you ever thought about creating an e-book or guest authoring
    on other websites? I have a blog centered on the
    same topics you discuss and would really like to have you share some stories/information. I
    know my viewers would appreciate your work. If you’re even remotely
    interested, feel free to send me an e-mail.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>