We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23571
    • 223 Posts
    I should note that this is on revo 2.1

    Using this plugin:

    https://github.com/jkenters/modMobile

    (pastebin version of the main plugin page)

    http://pastebin.com/Qxz43Z5k


    The plugin detects the useragent, then uses $modx->resource->set(’template’,

    to set the mobile template.



    The event the plugin was tied to was "onLoadWebDocument"

    The problem appeared to be that this was getting cached, so if you clear the cache, visit the site with a mobile user agent, it gets set, but then if you visit with a desktop user agent, it is still set to mobile.

    I added the event "onLoadWebPageCache" as well, but it doesn’t seem to fix the caching problem.

    This still happens even if all caching is disabled.

    Is this the wrong use of $modx-resource->set(’template , is there something else we should be using instead?
    • If the Resource is cacheable, you cannot change the Template. It will only be processed by the first request anyway. Make the Resource non-cacheable if you want to dynamically change the Template. This worked before because of a bug fixed for 2.1 that was reprocessing the Template even when cached.
        • 24068
        • 4 Posts
        Hello,

        even if modMobile would work, there is still no way for the user to switch to the normal presentation of the website.

        So yes, you should use something else. I cant realy tell what "something else" exactly is, as i’m also trying to figure out what the best way is to switch to handheld-layouts.
          • 32316
          • 387 Posts
          I’m looking at this approach:
          http://www.alistapart.com/articles/responsive-web-design/

          So not switching html templates - just using css that alters presentation based on the browser window width.
            • 24068
            • 4 Posts
            Thank you, interesting link.

            The "Only with CSS" way is a route i would like to go.
            And i think it is the way we are all should go.
            But will the browsers let us?
              • 23571
              • 223 Posts
              We have been looking at http://lessframework.com/, seems like a pretty good approach. Definitely better than making separate templates for different devices.
                • 1169
                • 312 Posts
                I have used less.js for a template to change the color scheme it worked very well for that. It generated the colors needed from one system variable I added to the manager. I could see it working using a variable from the screen size.
                Good luck with your implementation. You can see how I went about it in my signature if you are interested.
                  DEVELOPMENT ENV:- Ubuntu 12.04 | MODx Revolution 2.2.8 | LAMP 2i Apache 2.2.22 | Php 5.3.10 | Mysql 5.5.31 MySQL client version: 5.5.31
                  • 24068
                  • 4 Posts
                  Quote from: pleth at Jun 11, 2011, 12:16 AM

                  We have been looking at http://lessframework.com/, seems like a pretty good approach. Definitely better than making separate templates for different devices.

                  Thanks for that link, it did put me on the right track.