By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,700 Members | 1,579 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,700 IT Pros & Developers. It's quick & easy.

directory link problem

P: 25
hello i have a simple question but i dont kno whow to handle.

the problem is:

i have a file (car.php) that i make include code like below:

require_once('./global.php');
require_once(DIR . '/includes/functions.php');
require_once(DIR . '/includes/functions_forumdisplay.php');


this file (car.php) is same directory with global.php and includes folder.
how if i want to create new folder and put car.php in this folder?

of course the directory also change right?

how to change the directory?

thanks
Apr 22 '10 #1
Share this Question
Share on Google+
3 Replies


Atli
Expert 5K+
P: 5,058
Hey.

You will just have to change the path to the included file to reflect the change.

For a file in the same directory, you would use ./file.php. For a file in the parent directory you would use ../file.php; in the grand-parent directory ../../file.php; etc...
Apr 22 '10 #2

P: 25
atli, im still blur here.
can i give real example and hope you will explain more clearly to me.. i have done what u already told me.. but the problem still same.

the problem is i have a filename that is car.php. in this file, i make include code like below:

require_once('./global.php');
require_once(DIR . '/includes/functions.php');
require_once(DIR . '/includes/functions_forumdisplay.php');

so, now i need to make car.php in a new folder as a car directory.
in this case car directory will same level with includes directory.

can u help me?
Apr 22 '10 #3

code green
Expert 100+
P: 1,726
You could use full path names throughout.
Or register them with set_include_path. But I would only do this with common files used in multiple scipts
Apr 22 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.