Search the Community
Showing results for tags 'include filename relative abs'.
-
Hi This is aquestion about absolute and realative addressing across a web host and a local testing server. I have just upgraded to Dreamweaver CS6 and want to use the php testing server. Previously I was just uploading everything and testing on the remote host. Problem is that I use lots of includes in my pages. Content is in a directory tree. This is an example. Content/conditions/back_pain/muscles.php which looks like THIS <?php include("/home/linweb15/b/mysite.co.uk-10629534829/user/htdocs/externals/main.php" );?> Thats the whole page. I use the full path because I use the same main.php to set out the layout for all the pages and a relative link fell down and I dont want to use a differnt relative path in each php file.. Then in the included main.php I have this function. function curPageName() { return "content/".substr(substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1),0,-4).".htm"; } Any in the middle of the page I put I use <?php include( '/home/linweb15/b/mysite.co.uk-10629534829/user/htdocs/'.curPageName() ); ?> which drops in the text from "content/muscles.php" All works fine on the remote web host. BUT These long file paths are no use on my testing server which is at c:xampp/htdocs/mysite I think I need to use a variable set to the first part of the file path and for this to be different on the host and the testing server. eg /home/linweb15/b/mysite.co.uk-10629534829/user/htdocs/ or c:xampp/htdocs/mysite At last the question..... How is this best done? Thanks John