How do I write an include to another file in another folder or point to another folder and files outside the directory ... FILE2.PHP <?php include("/foldername2/fileB.inc"); ?> folder and files within ... One file I want to use an include /foldername1/ FILE1.inc FILE2.inc FILE3.inc /foldername2/ fileA fileB fileC
you can use ../ to go up a directory say for example, you have /root/folder1/script1.php and /root/folder2/script2.php you can call script2 from script1 using include('../folder2/script2'); PHP:
Some programs use the "absolute path" approach. For instance, here's an excerpt from the file wp-config.php, from WordPress 2.6.1: <?php define('ABSPATH', dirname(__FILE__) .'/'); require_once(ABSPATH . 'wp-settings.php'); ?> PHP: The advantage of this method is that you don't have to know how many folders to go up, but what's the absolute path to your file. It's way much easier.