Jump to content

Unsure of why the page is not continuing to load after fucntions and array are..


TGWSE_GY

Recommended Posts

Ok so below is my index.php and config.master.php for some reason after the config.master.php is called it doesn't get through it and the page does not load. Any help would be appreciated.

 

Thanks

 

Index.php

<?php require_once('includes/config/config.master.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" href="simple.css" />
</head>

<body>
	<div id="container">
		<div id="header">
       	    	<center>

       	    	  <img src="images/logo.png" width="800" height="150" alt="DeeJay Octane" />
       	    	</center>
            </div>
            <div id="nav">
            <center><a id="navi_link" href="../index.old.php?section=1">HOME</a><a id="navi_link" href="../index.old.php?section=2">ABOUT</a><a id="navi_link" href="../index.old.php?section=3">MIXOLOGY</a><a id="navi_link" href="../index.old.php?section=4">BLOGS</a><a id="navi_link" href="../index.old.php?section=5">PRESS</a><a id="navi_link" href="../index.old.php?section=6">CONTACT</a></center></div>
            <div id="content">
            	<?php $getit = grabpage(); include($getit); ?>
          </div>

            <div id="footer">
            	<center>
            	  <font style="background-color:#000;">Designed & Developed By <a href="http://www.visualrealityink.com">Visual Reality ink.</a></font>
            	</center>
          </div>
	</div>
</body>
</html>

 

config.master.php

<?php

//We will build the $pgid array first
$pgID = array([0]=>"home", [1]=>"about", [2]=>"mixology", [3]=>"blogs", [4]=>"press", [5]=>"contact");

//FUNCTIONS//
function grabpage(){
//Test if ID is present in URL
if(isset($_GET['ID'])){
	//TRUE then store value of ID from URL in $pg
	$pg = $_GET['ID'];
	//Loop through the $pgID array until a match is found
	foreach($pgID as $key => $value){
		//Test to see if $pg is NOT equal to current array item key
		if($pg != $key){
			//if above test IF is true then we continue to the next itteration in the loop
			continue;
		//if the above is not true then we test to see if $pg is equal to $key
		}elseif($pg == $key){
			//if $pg is equal to $key we then
			//set $getthispage to "content/directory/" concatinate $value concatinate ".file_extension"
			$getthispage = "includes/content/" . $value . ".php";
			return $getthispage;
			break;
		}
	}
}else{
	$getthispage = "includes/content/home.php";
	return $getthispage;
}
}

?>

 

http://www.deejayoctane.com/new/index.php

 

Thanks

What does error_reporting say?

 

<?php
error_reporting(2047);
ini_set("display_errors",1);
?>

 

You might want to use in_array (http://us.php.net/in_array) instead of a for loop.

 

(array_key_exists("ID", $_GET) && in_array($_GET["ID"], $pgID)) ? require_once(sprintf("include_path/%s", $gdID[$ID])) : require_once("home.php");

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.