Jump to content

Troubleshooting a page that won't load?


subnet_rx

Recommended Posts

I have a page that processes a variable passed in the url to go get information out of a text file in JSON format.  For some reason though, passing one variable loads a page, passing a certain variable (who's data in the file is virtually identical to the first)  will cause the browser to just load the page indefinitely.  Maybe even more strange is that on my local machine, the variable that won't load is switched, and the other loads fine.  How can I debug what's happening when the page never loads so that I never get an error?

Link to comment
Share on other sites

I think I've determined this is a browser issue, but I wouldn't mind someone taking a look at the code to see if I'm doing things correctly

 

<?php
	$menu_id=filter_input(INPUT_GET, 'q', FILTER_SANITIZE_NUMBER_INT);
	if (isset($menu_id)) {
		$url = "http://www.mysite.com/json/mobile_menu/".$menu_id;
		//load menu items
		$string=file_get_contents($url);
		$menu_object=json_decode($string);
		$m = $menu_object->nodes[0];
		//load external links in menu
		$lurl = "http://www.mysite.com/json/external_links/".$menu_id;
		//load menu items
		$lstring=file_get_contents($lurl);
		$ext_object=json_decode($lstring);
	}
	else {
		header( 'Location: http://m.mysite.com/' ) ;
	}
?>
<!DOCTYPE html> 
<html> 
<head> 
<title><?php print($m->menu->Menu_Title); ?></title> 	
<?php require_once 'includes/header.inc.php';  ?>
</head> 
<body> 
<div id="nid_menu" data-role="page">
<?php require_once 'includes/header_div.php';  ?>
<div data-role="content">
    <h1 class="menu_header"><?php print($m->menu->Menu_Title); ?></h1>	
    	<ul data-role="listview" data-dividertheme="a">
	<?php 
		if (isset($m->menu->Title)) {
		foreach($menu_object->nodes as $m) {
			if ($m->menu->Type == "mobile_menu") {
				echo '<li><a href="./menu.php?q='.$m->menu->Nid.'">'.$m->menu->Title.'</a></li>';
			}
			else {
				echo '<li><a href="./page.php?q='.$m->menu->Nid.'">'.$m->menu->Title.'</a></li>';
			}
		}
		}
	?>
        <?php if (array_key_exists("nodes",get_object_vars($ext_object))) { ?>
        <li data-role="list-divider">Other Resources</li>
        		<?php

		foreach($ext_object->nodes as $e) {
			echo '<li>'.$e->link->Link.'</li>';
		}}
	?>
	</ul>	
</div>
<?php require_once 'includes/footer.php';  ?>
</div>	
</body>
</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.