Jump to content

Help With Includes On Testing Server


Recommended Posts

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.