timmy0320 Posted February 24, 2008 Share Posted February 24, 2008 [PART 1] Alright I have defined some constants for my root directory of files. define("ROOT_DIR", "/new_work/"); define("ROOT_URL", "http://" . $_SERVER['HTTP_HOST']."".ROOT_DIR.""); This function works until I use it in a sub-directory. Now I figured out that I had to turn on allow_url_include on my php.ini settings. I did that and now works. (session.php includes constants.php which contains the above constants) include("../session.php"); include("".ROOT_URL."templ/header.php"); Now I'm making my pages all on my computer and personally hosting them before I upload anything to my Webhost. I've read that a lot of web hosts (and Yes I do plan on contacting mine) have this option turned off . I am having trouble figuring out how to do this without linking it by URL . I can do just the ROOT_DIR but then my pages in the sub-directories link wrong. Sub-directories will then link as /dir/include when it's supposed to be just /include/ from the main directory. Any tips on a better way? [PART 2] I define all my pages at the top. define('MYSITE', true); All of my includes are as: if (!defined('MYSITE')) { exit; } All of my includes are including except my header and footer and they are all setup the same way and I am lost as to why it's doing this just for those two files. Could it be the order of my includes or what's the deal with this all of a sudden not working? It's only doing it in the sub-directory and the define() are at the TOP of the page before includes. 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.