Jump to content

Question about 'include' paths


JetJagger

Recommended Posts

Any help is much appreciated in advance...

 

I have a master file located along the root path that needs to be included in subdomains.  Inside the master file are includes like

<?php include("../bodyCopy/anyfile.php"); ?>

that need to reference the /bodyCopy directory IN THE SUBDOMAIN and NOT along the root.

 

The problem that I'm having is that the master file resides OUTSIDE of the subdomain on the root (in a '/bodyCopy' directory.

 

How do I write the PHP include so that files included in a subdomain from outside of the subdomain (on root) search directories INSIDE the subdomain and NOT relative to the root path?

 

Here's what I mean.

 

I have this file sitting on the root:  /home/xxxx/public_html/constructfiles/filetoinclude.php

 

It needs to be included here:  /home/xxxx/public_html/SUBDOMAIN/publicfile.php

 

Then, 'filetoinclude.php' needs to include other files that are here:  /home/xxxx/public_html/SUBDOMAIN/bodyCopy/otherfilestoinclude.php

 

...but, 'filetoinclude.php' is searching along the root path for '/home/xxxx/public_html/bodyCopy/otherfilestoinclude.php' (which does not exist), and NOT within the SUBDOMAIN for the '/home/xxxx/public_html/SUBDOMAIN/bodyCopy/otherfilestoinclude.php' like I need it to.

 

It appears that PHP will only search along the root path of the included file and NOT the root path of the file in which an include is included.

 

I'm confusing myself now, but I hope someone can help.

 

Thanks,

 

Jet

 

-

 

 

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.