PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi
I've created this news script that I will eventualy relese publicly and have everything working greate however I am unable to include a file needed for one of the files that displays the news. For example I need to inclue a news.php files but in that file I need a config.php file. Here is the code for the news display includes:
include "admin/config.php" looks in your standard include directory (such as /etc/php4/includes) for the admin folder. Therefore, php is not finding the proper file.
To use another location, you must either hard-code it (ex: "/path/to/admin/config.php") or use relative paths (ex: "./admin/config.php"). Using "./" starts looking in the current directory, and "../" starts looking in the script's parent directory.
/*
folder tree:
index.php
pages/news.php
admin/config.php
*/
// so in index.php you have
include("pages/news.php");
// and in news.php you have
include("admin/config.php");
The all paths in news.php and config.php must be write in the way that they were in the index.php.