Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jeroen Mink 12 posts 51 karma points
    Dec 10, 2012 @ 11:22
    Jeroen Mink
    0

    Mobile template in 4.11

    Hi all,

    We want to build a mobile site which supports phones and tablets. Since tablets have a bigger screen we want to build separate HTML for it, but without using a responsive design. The site will be one tree in Umbraco so we're thinking about switching between templates based on the capabilities of the device. I saw this: http://www.hanselman.com/blog/NuGetPackageOfTheWeek10NewMobileViewEnginesForASPNETMVC3SpeccompatibleWithASPNETMVC4.aspx and was wondering if this was the way to go using Umbraco 4.11. Are there any thoughts on what's the way to go for this?

     

  • Jon R. Humphrey 164 posts 455 karma points c-trib
    Dec 10, 2012 @ 13:01
    Jon R. Humphrey
    0

    have you looked at http://51degrees.mobi/?

    You can serve different paths to different devices depending on detection .... [say that 10 times fast!]

    Hope this helps!

    J

  • Jeroen Mink 12 posts 51 karma points
    Dec 10, 2012 @ 14:55
    Jeroen Mink
    1

    For now i added a 'master' controller which all my custom controllers (which build a custom model in 90% of the pages) inherit from. In that controller i have the following to do the switch between templates. For the mobile capability detection we're using http://blog.mobileesp.com/

        public class BaseController : Umbraco.Web.Mvc.RenderMvcController
        {
            public override ActionResult Index(RenderModel model)
            {
                var context = System.Web.HttpContext.Current;
    
                var currentTemplate = base.ControllerContext.RouteData.Values["action"].ToString();
    
                if (currentTemplate.Contains("MobilePhone"))
                {
                    //user is in mobile site and can be redirected
                    var mobileDetection = new MobileDetection(context);
                    if (mobileDetection.DetectTierTablet())
                    {
                        var newTemplate = currentTemplate.Replace("MobilePhone", "MobileTablet");
                        if (this.EnsurePhsyicalViewExists(newTemplate))
                        {
                            //it's a tablet, return the alternate tablet-view
                            return View(newTemplate, model);
                        }
                    }
                }
    
                return base.Index(model);
            }
        }

    Any more thoughts on how it's solved?

  • Chad Rosenthal 272 posts 474 karma points
    Dec 10, 2012 @ 15:00
    Chad Rosenthal
    0

    Look at something like Twitter Bootstrap that will allow you to create a Responsive Design website where no matter what your resolution of the phone/tablet/screen, you can have a design that matches it without having to create new templates.

     

Please Sign in or register to post replies

Write your reply to:

Draft