Not sure if this is the right area for this, but I have a question about using PHP requires. I currently am building my site and using the require command to include a table of contents on my pages. However, I have to change the paths every time I change from testing locally (using Apache server, PHP 5) to uploading to my live site. Is there anything I can do to make both use the same paths?<!--content-->
I ran into the same thing<br />On my local server the root folder is used by the server <br />so I use folders for each site<br />and can't get include $_SERVER['DOCUMENT_ROOT']."/filename.php";<br />to work locally.<br />So I just use relative or put the include files in a sub folder and <br />include ("folder/filename.php");<br /><br />You could create two text files for local and remote called path.php<br />and include it and have it set the include path for where ever you are.<!--content-->
<!--quoteo(post=148739:date=Sep 14 2005, 01:22 PM:name=TCH-Don)--><div class='quotetop'>QUOTE(TCH-Don @ Sep 14 2005, 01:22 PM) <a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=148739"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><div class='quotemain'><!--quotec-->I ran into the same thing<br />On my local server the root folder is used by the server <br />so I use folders for each site<br />and can't get include $_SERVER['DOCUMENT_ROOT']."/filename.php";<br />to work locally.<br />So I just use relative or put the include files in a sub folder and <br />include ("folder/filename.php");<br /><br />You could create two text files for local and remote called path.php<br />and include it and have it set the include path for where ever you are.<!--QuoteEnd--></div><!--QuoteEEnd--><br />Well I'd sort of given up on this but then I remembered your comment about using the two text files. Could you explain that in a little more detail? Perhaps give me an example?<!--content-->
I ran into the same thing<br />On my local server the root folder is used by the server <br />so I use folders for each site<br />and can't get include $_SERVER['DOCUMENT_ROOT']."/filename.php";<br />to work locally.<br />So I just use relative or put the include files in a sub folder and <br />include ("folder/filename.php");<br /><br />You could create two text files for local and remote called path.php<br />and include it and have it set the include path for where ever you are.<!--content-->
<!--quoteo(post=148739:date=Sep 14 2005, 01:22 PM:name=TCH-Don)--><div class='quotetop'>QUOTE(TCH-Don @ Sep 14 2005, 01:22 PM) <a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=148739"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><div class='quotemain'><!--quotec-->I ran into the same thing<br />On my local server the root folder is used by the server <br />so I use folders for each site<br />and can't get include $_SERVER['DOCUMENT_ROOT']."/filename.php";<br />to work locally.<br />So I just use relative or put the include files in a sub folder and <br />include ("folder/filename.php");<br /><br />You could create two text files for local and remote called path.php<br />and include it and have it set the include path for where ever you are.<!--QuoteEnd--></div><!--QuoteEEnd--><br />Well I'd sort of given up on this but then I remembered your comment about using the two text files. Could you explain that in a little more detail? Perhaps give me an example?<!--content-->