Jump to content


Help With Includes On Testing Server

include filename relative abs

  • Please log in to reply
1 reply to this topic

#1 backsmith

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 13 December 2012 - 09:03 PM


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.


which looks like THIS

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.


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.


At last the question.....

How is this best done?



#2 PFMaBiSmAd

  • Staff Alumni
  • Advanced Member
  • 16,767 posts
  • LocationColorado, U.S.A.

Posted 13 December 2012 - 10:12 PM

Signature: (not a comment about anything you posted unless specifically indicated)
Debugging step #1: To get past the garbage-out equals garbage-in stage in your code, you must check that the inputs to your code are what you expect.

Programming is just problem solving, but it is done in another language. You must learn enough of the programming language you are using to be able to read and write code.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users