I have been trying to understand the logic of included files in php.
I have these files:
index.php
inc/footer.php
inc/navbar.php
inc/toplinks.php
index.php sez:
include ('inc/footer.php');
footer.php sez:
include ('navbar.php');
include ('inc/toplinks.php');
The navbar.php file loads correctly and grabs the values passed from index.php. It also works where the include sez:
include ('inc/navbar.php');
There is only one file named navbar.php.
There is a second file named toplinks.php in the root directory.
If footer.php sez:
include ('toplinks.php');
it calls the file from the root directory.
Does php search all possible directories (the directory of the original including file, as well as the directory of the included file?
Nothing works if it sez:
include ('/inc/toplinks.php'); or include('/inc/navbar.php');
Is there a difference between double quotes and single quotes?
Thanks
Mike
I have these files:
index.php
inc/footer.php
inc/navbar.php
inc/toplinks.php
index.php sez:
include ('inc/footer.php');
footer.php sez:
include ('navbar.php');
include ('inc/toplinks.php');
The navbar.php file loads correctly and grabs the values passed from index.php. It also works where the include sez:
include ('inc/navbar.php');
There is only one file named navbar.php.
There is a second file named toplinks.php in the root directory.
If footer.php sez:
include ('toplinks.php');
it calls the file from the root directory.
Does php search all possible directories (the directory of the original including file, as well as the directory of the included file?
Nothing works if it sez:
include ('/inc/toplinks.php'); or include('/inc/navbar.php');
Is there a difference between double quotes and single quotes?
Thanks
Mike