ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Mobile specific themes

August 23, 2012 10:16am

Subscribe [1]
  • #1 / Aug 23, 2012 10:16am

    Lima Bean

    13 posts

    Hi everyone

    I’m looking into building my second EE based mobile site, running on a subdomain using the same control panel as the full version of the site. Previously I’ve used the method detailed here http://www.netmagazine.com/tutorials/going-mobile-expressionengine - which seems to be the standard way, and while I don’t have any particular problem with doing it that way, I’d be interested to know if there’s a more elegant solution. Ideally what I’d like to do is have a seperate theme and load that instead of the default theme if we’re using the mobile domain, does anyone know if that is possible? What I’m envisioning is programmatically setting the theme via the mobile site’s index.php file, or something similar.

    Any help appreciated.
    Thanks.

  • #2 / Aug 23, 2012 5:23pm

    Shane Eckert

    7174 posts

    Hello Lima,

    Thank you for posting your question here on the ExpressionEngine forums.

    I was not aware of that article. Neat. I like it, seems like a nice way to come at implementing mobile themes.

    I can move this over to the Community Help Forum to see if there are any more mobile implementation suggestions if you would like.

    Cheers,

  • #3 / Aug 24, 2012 3:43am

    Lima Bean

    13 posts

    Ok great, thanks. Please do.

  • #4 / Aug 24, 2012 5:17am

    Lima Bean

    13 posts

    For anyone interested I’ve more or less found the solution I was looking for in the comments of the article I mentioned above (comment 3 by darrenmiller)

    There’s an alternative (and I believe simpler and better) approach to this and that it is to use a totally different set of templates for the mobile site. Whilst the above method will work fine, it relies on embeds (and Embeds Are Bad) which is not intuitive to maintain and can reduce performance. Better to have a completely dedicated set of templates I think. It also gives you the option to vary the site structure for mobile if you want to.

    This technique assumes that:
    - you’re on a different domain or subdomain for mobile
    - you save template files to disk
    - you don’t mind that the mobile templates are not visible from the CMS

    Just add the following to your config.php file:

    if($_SERVER[‘SERVER_NAME’] == ‘my_mobile_domain’) {
    $config['tmpl_file_basepath'] = '/path/to/mobile/templates/';
    } else {
    $config['tmpl_file_basepath'] = '/path/to/desktop/templates/';
    }

    and you’re off

    That seems to work pretty well.

  • #5 / Aug 24, 2012 3:40pm

    Shane Eckert

    7174 posts

    Hey Lima,

    Awesome! Glad to hear it!

    If you need anything else, please just let me know by opening a new thread.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases