PDA

View Full Version : how to pull scripts from another directory


Fou-Lu
01-07-2003, 03:47 AM
Exactly as stated. How do I go abouts including scripts that are in another directory? As in, would it be something like
<?php include('./different_directory/fileIwant.php')?> or something of the sorts?

ez4me2c3d
01-07-2003, 04:04 AM
<?php include("pathtofile/filename.ext"); ?>

Kiwi
01-07-2003, 10:20 AM
Alternatively, you can add the directory to your include path in the php.ini file (or using an ini_set statement), then just type the file name.

Akito
01-07-2003, 07:55 PM
If you need to go to a directory that is not a subdirectory of the one your script is in, you can use ".." to go "up" a level. For example:

Script Directory: /public_html/scripts/script_a

Directory of script you want to include: /public_html/helloworld

include is:

<?php include("../../helloworld/<nameofscript>"); ?>

Fou-Lu
01-07-2003, 09:41 PM
Ok, good good. Thats what I was looking for.