SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru
    Join Date
    Jul 2003
    Location
    england
    Posts
    822
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Question jQuery Mobile Switch code not working?

    Can anyone tell me if there is something wrong with this code? The idea is that if there is a mobile device detected it will switch to a different page template. The problem is that the result is a blank page (apparently an Error 404 page from what Chrome is returning). The templates mobile.php and standard.php do work because I tested them, which brings me to believe that there is something wrong with this code.

    Code:
    <?php
    /**
     * @author      Christian Schuelling
     * @package     Joomla!
     * @subpackage  Was Wenns Regnet
     * @link        http://whykiki.de
     * @email       info@whykiki.de
     * @copyright   Christian Schuelling
     *
     * Was Wenns Regnet
     * Copyright (C) 2012 Christian Schuelling
     *
    **/
    
    defined( '_JEXEC' ) or die( 'Restricted access' );
    
    
    ////////////////////////////////////////////////////////// hier kommt lädt man allen relevanten Stuff, den man braucht, der aber keine Ausgabe macht.
    
    // Gib mir den Menü Kram
    $itemid = JRequest::getVar('Itemid');
    $menu = &JSite::getMenu();
    $active = $menu->getItem($itemid);
    $params = $menu->getParams( $active->id );
    $pageclass = $params->get( 'pageclass_sfx' );
    
    
    include 'Mobile_Detect.php';
    $detect = new Mobile_Detect();
    
    if ($detect->isMobile()):	
    require_once("mobile.php");
    else:
    	require_once("standard.php");
    endif;
    ?>

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,151
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    Is there anything in the error log that would indicate a problem with this script or one associated with it? There isn't really much to go on here. Especially, for people who are not familiar with the Joomla or that specific component being used.
    The only code I hate more than my own is everyone else's.

  3. #3
    SitePoint Guru
    Join Date
    Jul 2003
    Location
    england
    Posts
    822
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by oddz View Post
    Is there anything in the error log that would indicate a problem with this script or one associated with it? There isn't really much to go on here. Especially, for people who are not familiar with the Joomla or that specific component being used.
    Hello, oddz.
    No error log to supply. It's part of a jQuery Mobile package created by the author above. I event tested the package itself as is and still came up with the same result. I emailed the creator and have not received a response. Would I be better posting this in the CMS forum? I figured since it was PHP related I'd post it here.

  4. #4
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,151
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    Well in an effort to narrow down the culprit I would recommend going to line by line adding echo and exit until the script fails. When the script fails you know the culprit is than the line right before the echo/exit debugging.
    The only code I hate more than my own is everyone else's.

  5. #5


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •