0
Welcome Guest! Login
0 items Join Now

iphone droid mobile template discussion

    • Martin Simpson's Avatar
    • Martin Simpson
    • Hero Rocketeer
    • Posts: 276
    • Thanks: 0
    • President Blue-Eyed Panda LLC

    iphone droid mobile template discussion

    Posted 13 years 3 weeks ago
    • I have noticed there is not a lot of help going out from the forum for older templates that use the mobile detection etc.. I have searched through and through so I thought I would put one solution I have found here and include key words like

      iphone , mobile, droid, etc...

      I added the following lines to my template's index.php above the gantry calls so it would redirect the homepage to the /m-home page I setup in the mobile menu as the homepage there.

      The problem I was having was my / page was not loading well in the mobile version so I wanted the mobile version when the full url was entered to actually redirect to the /m-home page I setup in the mobile-main menu.

      I have alternate content and modules all published for the mobile versions.

      Here is the PHP that sniffs out if we are on the homepage - and then sniffs out the browser. I have not tested this on droid, but have on my iphone. Any droid users let me known what happens.

      basically -- martysimpson.com loaded in a droid should redirect to /m-home.

      Thanks.

      CODE snippet below
      // put this right after the Restricted_access line from joomla.. in the template's index.php file.
      $menu = & JSite::getMenu();
      if ($menu->getActive() == $menu->getDefault()) {
       
           
           // Written By Adam Khoury @ developphp.com - March 26, 2010
           // PHP mobile browser detection ready Home Page(index file that detects and redirects)
           // Simply find the device OS or browser label and place conditionals as needed
           $agent = $_SERVER['HTTP_USER_AGENT']; // Put browser name into local variable
           
           if (preg_match("/iPhone/", $agent)) { // Apple iPhone Device
                // Send them to iphone sized homepage for mobile
                header("location: /m-home");
           
           } else if (preg_match("/android/", $agent)) { // Google Device using Android OS
                // Send them to android sized homepage for mobile
                header("location: /m-home");
               
           }
       
       
      }
    • President of Blue-Eyed Panda Website Design Services
  • Re: iphone droid mobile template discussion

    Posted 12 years 1 month ago
    • I just tried it on the Galaxy S2, and it didn't re-direct. Android 4.

      iPhone works though.Nice work.

      I want to add the detection to an older RT templace (Infuse), and want a popup to come up offering them to download the App instead.

      Have no idea how to do it yet, just beginning to research the possibility.

Time to create page: 0.047 seconds