Search

After getting an iPod Touch, I've been brainstorming on ways to make a mobile version of my Symphony site. Has anyone done this? I'd like to be able to publish pages on a subdomain, like m.joshnichols.com, and only use one instance of Symphony to do it.

Unfortunately, the only way I can think of to achieve that is to install another instance of Symphony at the subdomain and have all of it's datasources be dynamic ones from my main site's XML feeds.

Any ideas on how to achieve this with Symphony 2? Would that need a plug-in?

Thanks!

You might be able to do it if instead of a subdomain you pass a URL parameter to the system. So instead of http://example.com it could be, say http://example.com/m. Of course if you still want to use the subdomain instead, you could just do a rewrite rule that takes any URL from that subdomain and transform it, so http://m.example.com/about becomes http://example.com/about/m.

Maybe not the prettiest, but might allow you to leverage some of Symphony's built-in flexibility.

[...] and only use one instance of Symphony to do it.

I'm not completely sure about the relevant trade-offs for single-instance vs multiple-instance implementation, but consider not one instance, not two, but (wait, there's more!) three instances.

  1. Master: where all content is published, and compiled into page-oriented DSs
  2. Mobile Client: using static XML DSs grabs data from Master and performs basic transformations to serve it in a mobile format
  3. Non-Mobile Client: does the same as Mobile Client but for non-mobile format

You only need to login to Master to publish. I think this approach also involves the least redundancy of templating logic.

Of course, if eliminating redundancy is your goal, you could always just use one version for both mobile-optimised and non-mobile browsers.

It would be super neat if the templating logic could choose templates based on incoming data. And we could do this via a sweet UI to do it. So if the browser is x, we do something. Not that it's specifically needed, but could do a lot. I guess it opens it up a little bit to the view system in django (similar, but most definitely not the same).

"It would be super neat if the templating logic could choose templates based on incoming data."

This is possible. I have something like this set up (unfortunately I can't share it b/c it's for work). Basically the template or theme is an XML file, and is processed as source XML. It contains elements that reference different XSL/DS pairs, outputting the different components of the page. Kind of like a 'meta-template' .

As long as Symphony has access to browser/agent info, you could easily load a totally different version of the site based on the browser (in my scheme transforming a different 'theme' xml source file).

ashooner, how would this compare to apache content negotiation?

Maybe you are thinking too complicated? The subdomain thing might be rather simple:

You could map your subdomain to a different directory on the server. In this directory you put a dedicated manifest folder (with it's own config.php file, of course, containing the subdomain and its directory.) The rest of the "subdomain system" may simply consist of symbolic links to the "original" system. (Well, to create symbolic links you will probably need SSH access to your server/webspace.)

Now in Symphony you could build some template logic based on the $root parameter. Like so:

<xsl:choose>
  <xsl:when test="$root = 'sub.domain.com'">
    <p>Hello, welcome to my subdomain</p>
  </xsl:when>
  <xsl:otherwise>
    <p>Hi there, welcome to my domain.</p>
  </xsl:otherwise>
</xsl:choose>

I am rather sure that something like this will work.

[EDIT]: Think of the subdomain thing as a "satellite system". You will still log in to the main system, receiving login cookies from the main domain. This also means that on the subdomain the $is-logged-in parameter will not work!

With some modified rewrite rules you could then give the subsomain a different 'home' page, for a blog or some such.

Is anyone willing to share some sample code from a htaccess file that demos using a subdomain to provide a persistent mobile param.

Any advice or recommendations on creating a mobile version most welcome? I think my preferece is to use the main structure and data sources and just tweak the output via xsl. Guessing I could achieve this with a global variable based on the root url param? Also considering a html5 version via subdomain.

I have been considering my preferred way of implementing a mobile version of a site. Detect a mobile device and redirect to sub domain or mobile doamin. Provide a clear link back to the full version from the mobile version. Using media queries and jQuery Mobile the mobile site can provide a cross platform and device solution.

I need to detect mobile devices and redirect, and provide a override for a mobile user to access the full version.

Has anyone implemented anything similar using Symphony?

There is the Mobile Device Detection Extension. You can use this to redirect mobile devices to a different subdomain and set a cookie when the user wants to visit the normal version via a link to prevent further redirections.

I have had a look at this extension there is currently no functionality to deal with redirecting and either using cookies or sessions to allow users to choose a version after redirect. It has helped me get a better understanding of a basic extension modifying the XML output though.

With regards to redirecting will that even be possible at this point? Has Symphony started sending data to the browser meaning I cannot redirect? Where would this happen the current detection logic happens in a grab function and returns XML guessing this might be too far down the processing order for a redirect.

Looks like this might be a good project to finally get into the workings of Symphony.

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