TGWSE_GY Posted May 18, 2010 Share Posted May 18, 2010 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 Quote Link to comment Share on other sites More sharing options...
CodeMaster Posted May 18, 2010 Share Posted May 18, 2010 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"); Quote Link to comment Share on other sites More sharing options...
TGWSE_GY Posted May 18, 2010 Author Share Posted May 18, 2010 Parse error: syntax error, unexpected '[', expecting ')' in /var/www/vhosts/deejayoctane.com/httpdocs/new/includes/config/config.master.php on line 4 but the paren is there?!?!?!?!? Quote Link to comment Share on other sites More sharing options...
CodeMaster Posted May 18, 2010 Share Posted May 18, 2010 $pgID = array("home", "about", "mixology", "blogs", "press", "contact"); The error was generated by the [...] on line 4. You can use the code above or remove the []. Quote Link to comment Share on other sites More sharing options...
TGWSE_GY Posted May 18, 2010 Author Share Posted May 18, 2010 LOL Codemaster thanks, I just came back to post that I had found the issue. I think because I was looking at the array information @ php.net that I arbitrarily used [] around the array indexes. Thanks again Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.