PDA

View Full Version : include


tony09uk
06-20-2011, 10:06 PM
I am trying to use the include function for my first attempt at a php website. I have split the header, navbar, mainbody and footer into different HTML files and added

include("includes/header.html");
include("includes/navBar.html");
include("includes/home.html");
include("includes/footer.html");

the files have been saved to my folder but when I check in live view I get the following message

Warning: include(includes/header.html) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\DHTML\index.php on line 3

Warning: include() [function.include]: Failed opening 'includes/header.html' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\DHTML\index.php on line 3

Warning: include(includes/navBar.html) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\DHTML\index.php on line 4

Warning: include() [function.include]: Failed opening 'includes/navBar.html' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\DHTML\index.php on line 4

Warning: include(includes/home.html) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\DHTML\index.php on line 5

Warning: include() [function.include]: Failed opening 'includes/home.html' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\DHTML\index.php on line 5

Warning: include(includes/footer.html) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\DHTML\index.php on line 6

Warning: include() [function.include]: Failed opening 'includes/footer.html' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\DHTML\index.php on line 6

What am I doing wrong. The files are in the folder.

PS
Ive also tried saving my files as .php and tried ../ (after reading the tutorial at http://www.dreamweaverclub.com/php-includes.php)

edbr
06-23-2011, 01:04 AM
site address?

DWcourse
06-23-2011, 03:39 AM
Looks like you aren't linking to your include files correctly. Is the includes folder in the same directory as your index.php file (DHTML)?

tony09uk
06-23-2011, 06:41 PM
yes they are

DWcourse
06-23-2011, 09:36 PM
can you post is online and let us look?