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!
I wonder why
<?php include('includes/header.php'); ?> does not works. In other words, the codes that I have place in header.php does not appears in index.html when I run it in IE.
no errors. It's just after I cut and paste the codes from index.html and move it header.php and writes: <?php include('includes/header.php'); ?> , the header disappeared.
Warning: include(../includes/header.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\php_template\index.php on line 29
Warning: include() [function.include]: Failed opening '../includes/header.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\php_template\index.php on line 29
Warning: include(../includes/nav.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\php_template\index.php on line 31
Warning: include() [function.include]: Failed opening '../includes/nav.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\php_template\index.php on line 31
strange I have the file path correctly but the errors still appears
How exactly are you coding your include directory link as sometimes Xampp does not like it to have ./ or / before your folder name. So take out those if you have them first.
You need to post all your code so I can see exactly what you have and are working with.
I want to help but I am a little confused.
The error codes above mention a nav.php yet you have not stated anything about his file in your code.
Also, what folder is your index.php file in and where is your include folder compared to your folder with the index.php file in?
Is it in php_template directory and you have an includes folder in that because you surely would not be telling the server to look back a folder which would take it into the htdocs folder where your php_template directory sits.
../ takes it back one. So it is confusing to see your code say one thing but your error say another. lol
If you are going to use something like <div id="header"> in a php statement then you need to either do this: <div id='header'> or this: echo "<div id=\"header\">";
You need to make sure you backslash your quotation marks otherwise you end your statement and start it again which makes the text in the middle of your quotation marks bring up an error as its not a true php statement.