> Thanks, John- that works brilliantly. > Just wandering how I can include a file in a different > directory so that it still remembers variables. > > for example what if I want to include the file > www.example.com/two/example.php in the file: > www.example.com/one/example.php > ? > would include('/two/example.php') work?
Stop thinking of include files as www.example.com/file.php. You're including a file that's within the same file system as the original file, so you just need to provide a correct path. If you have /home/example/www/one/example.php and you want to include /home/example/www/two/example.php into it, then you can do two things: include("../two/example.php") which will go from the one/ directory, go up one, into the two directory, and then access the example.php file. This is called a relative path, since it is relative to the one/example.php file. or, you can do include("/home/example/www/two/example.php"); This is an absolute path. Use whichever you understand. One thing you may come accross that you need to understand is that all includes, if you're using relative paths, are relative to the original file. so if one/example.php includes two/example.php and then two/example.php tries to include another file using a relative path, it's going to start relative to the one/ directory, no the two/ directory. You don't have this problem/issue with absolute paths. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php