MasterACE14 Posted August 30, 2009 Share Posted August 30, 2009 Hello, I have my script setup like the following... <?php // main file // include GET engine require_once("C:\wamp\www\GETengine\index.php"); // start require_once("start.php"); require_once("includes.php"); // HTML compression if($config['htmlcompress'] == 1) ob_start( 'ob_gzhandler' ); ?> <!-- HTML... header.. left panel etc --> <div id="content"> </div> in the #content div, a PHP file is loaded with the use of AJAX depending on what link was clicked. However what I have at the top with the 3 require_once()'s they aren't included in whatever PHP file is loaded in the #content div. Is there a way so I can include those 3 files in each page loaded in #content, without actually copy & pasting that into each individual PHP file? Any help/info/suggestions are appreciated. Regards, Ace Quote Link to comment Share on other sites More sharing options...
trq Posted August 30, 2009 Share Posted August 30, 2009 Call require_once within the scripts that are being requested via ajax. Quote Link to comment Share on other sites More sharing options...
MasterACE14 Posted August 30, 2009 Author Share Posted August 30, 2009 I've just changed the files so require_once is called within the scripts like you suggested. // include GET engine require_once("../GETengine-1.0.0/index.php"); // start require_once("../start.php"); require_once("../includes.php"); that works fine for the last 2. But for the GET engine I'm getting a error I haven't encountered before :S Fatal error: Uncaught exception 'InvalidArgumentException' with message 'The given path is not a directory.' in C:\wamp\www\newcf\GETengine-1.0.0\includes\functions.php:51 Stack trace: #0 C:\wamp\www\newcf\gamefunctions.php(2): getDirectoryTree('gamefunctions') #1 C:\wamp\www\newcf\includes.php(2): require_once('C:\wamp\www\new...') #2 C:\wamp\www\newcf\lib\home.php(6): require_once('C:\wamp\www\new...') #3 {main} thrown in C:\wamp\www\newcf\GETengine-1.0.0\includes\functions.php on line 51 Quote Link to comment Share on other sites More sharing options...
trq Posted August 30, 2009 Share Posted August 30, 2009 What does line 51 of... C:\wamp\www\newcf\GETengine-1.0.0\includes\functions.php look like? Quote Link to comment Share on other sites More sharing options...
MasterACE14 Posted August 30, 2009 Author Share Posted August 30, 2009 throw new InvalidArgumentException('The given path is not a directory.'); It's apart of the Get Directory Tree function. function getDirectoryTree($path, $directorySeparator = "/", $startPath = null) { if (!is_dir($path)) { throw new InvalidArgumentException('The given path is not a directory.'); } if (null === $startPath) { $startPath = $path; } $startPathLength = strlen($startPath) + 1; $items = array(); foreach (new DirectoryIterator($path) as $item) { if ($item->isDot()) continue; if ($item->isDir()) { $items = array_merge($items, getDirectoryTree($item->getPathname(), $directorySeparator, $startPath)); } else { $name = substr($item->getPathName(), $startPathLength); if ($directorySeparator !== DIRECTORY_SEPARATOR) { $name = str_replace(DIRECTORY_SEPARATOR, $directorySeparator, $name); } $items[] = $name; } } return $items; } Quote Link to comment Share on other sites More sharing options...
MasterACE14 Posted August 30, 2009 Author Share Posted August 30, 2009 I've echo'd out the file path which it says is not a directory, and the path is correct. Fatal error: Uncaught exception 'InvalidArgumentException' with message 'The given path is not a directory.' C:\wamp\www\newcf\GETengine-1.0.0\modules 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.