A new extension, “Mobile Device Detection” is now available for download. Comments and feedback can be left here but if you discover any issues, please post it on the issue tracker.

Very cool.

A related thought: I recently got Alistair to fix up an old delegate for 2.0.7 that allows an extension to remove JS and CSS from the header. Your extension could be used in conjunction with a second extension that strips the default Symphony JS and CSS and replaces them to create a mobile-friendly interface.

It wouldn’t be easy, but at least for publish sections it could be doable.

Great idea with a nice and clean approach.

However, wouldn’t it make sense to add a class="iphone" attribute instead of iphone="true"? That way you could have class="android", class="palm" etc.

Or, although it doesn’t belong in the device-class, you could express something like

<device mobile="false" class="x86" browser="firefox">
   Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20100122 firefox/3.6.1

and have a really clean way of browser identification.

Spot on.. this was exactly what I was looking for right now in a project! Thanks for the work Max.

So has anyone here made an iphone specific version of their site yet with iwebkit?

@newnomad Hadn’t seen that one. I want to make a site with jQTouch, similar idea.

There is good discussions off all the available frameworls over at SO, although focus seems to be on applications. I would like to hear any experiences with pure content websites, extended with a lightweight iphone version. Some might argue its not even needed, since the iphone browses normal sites just fine…

has anyone tried out xui js?

@phoque: You’re right, there’s probably a more robust way of identifying alternative browsers. I built the extension to support the following use case, to serve:

  • Normal website
  • Mobile-optimised website
  • MobileSafari optimised website

Part of the reason I kept it simple is that I don’t know enough about the different devices that are available and I couldn’t find a really solid and flexible device detection class to use as the basis. The other reason I kept it simple is that the scenario I mentioned above is as far as I would bother taking platform-specific development at the moment. It would certainly be nice to be able to add specific rules for individual platforms further down the track though.

@newnomad: I haven’t used a framework to build up an iPhone specific version of a site. With Decaf Sucks—a Rails site I worked on last year—I just designed an iPhone appropriate interface instead and the Symphony site I’m working on now is pretty much the same idea. At the moment we’re doing some work on using Symphony as the basis for generating a native iPhone app using the Appcelerator Titanium environment.

Appcelerator seems good, it fits in my workflow I think. Not really helpful in making websites roll across all platforms today though.

Right now I’m just making most of my projects degrade well (or the other way arround, progressing up) so all content is available no matter what. That’s where this extensions fits in well. I’m working on a website with dragable windows and such which do no work that well on mobiles when it comes to interaction, even if they have the capabilities to make them work. So with this extension turning specific features on or off really helps.

@Makenosound Appcelerator seems excellent! Have a look on Cappuccino and 280 Atlas too.

Mobile Device Detection updated to version 1.1 on 4th of March 2011

All credit to Rowan (aka buzzomatic) for this update. He's rewritten the extension and made it much more powerful and flexible. The extension now has support for more devices — iPad and Android — and lets you redirect your mobile users to a different URL if you feel the need. In addition the extension also exposes the MobileRedirection delegate, which allows other extensions to override when and where a mobile device is redirected.

I have installed this extension locally with no problems. But when I upload to my server I get a PHP error:

Parse error: syntax error, unexpected TSTATIC, expecting TSTRING or T_VARIABLE or '$' in /XXX/extensions/mobiledevicedetection/libs/class.mobiledevice.php on line 7

Damn, should probably have coded it for PHP 5.2 and not 5.3, sorry.

@buzzomatic its a great extension I will speak to my hosts about PHP versions, thanks.

I am in the early stages of playing with this extension, the basic device detection works great. I am not able to use the redirect functionality though. The browser returns a error 'The page isn't redirecting properly' when trying to redirect mobile devices to

Any advice or help really appreciated.


Ah realised I had created the infinite loop. Fixed the problem by checking the redirect url isn't the current url:

$root = 'http://'.$_SERVER['HTTP_HOST'];
if ($can_redirect && $url != $root) redirect($url);

Guessing there should already be a variable available within the PHP I should use rather than generating my own $root.

Any idea why I get

Parse error: syntax error, unexpected T_STATIC, expecting T_STRING or T_VARIABLE or '$' in /var/www/vhosts/ on line 7

on my remote host?

lines 1-15


    class MobileDevice {
        static protected $instance;

        static public function instance() {
            if (!isset(static::$instance)) {
                static::$instance = new static();


            return static::$instance;

What version of PHP are you running?

PHP Version 5.2.4-2ubuntu5.17

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details