Reputation: 33
I have researched so much in blogs and forums and can not seem to find the solution to this problem. I am using the Wamp directory: C:\wamp\bin\apache\apache2.4.9\htdocs\lr
the lr at the end of the /htdocs is just the folder that I am holding my webpage in.
The code inside of my index.php :
<html>
<?php include('includes/head.php'); ?>
<body>
<?php include 'includes/header.php'; ?>
<div id="container">
<?php include 'includes/aside.php'; ?>
</div>
<footer>
© phpacademy.org 2011. All rights reserved.
</footer>
</body>
When I load the index.php in chrome or any browser the only thing that I am seeing is the footer which happens to be the only thing that is NOT set up in a php include tag.
Here is the code inside of my head.php
<head>
<title>Website Title</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/screen.css">
Very basic code which only gives me more confusion on why it is not working. If you would like more examples of code that I am using let me know. I will gladly provide some as I really need this to continue creating the database for my login/registration page(s).
Upvotes: 3
Views: 155
Reputation: 877
Try to close head tag first in your head include file, if that doesn't work, I will dig deeper :D
EDIT:
Sometimes there are problems with file path. I usually use:
<?php include $_SERVER['DOCUMENT_ROOT']."/filename.php";?>
In Your case that probably be:
<?php include $_SERVER['DOCUMENT_ROOT']."/lr/includes/header.php";?>
Upvotes: 0
Reputation: 1070
You can check if the included file exist, this can give you a clue to what is going on
if(file_exists('includes/head.php')):
include 'includes/head.php';
else:
echo 'file either not readible or does not exist';
endif;
Upvotes: 0
Reputation: 936
It is likely that PHP does not find the files to be included.
Are you sure the folder 'includes' is in the same directory as your index.php?
Also, I would suggest to use "**/**includes/..." with a slash at the start to be sure that it searches the included files from the root directory, and not from the relative path of your index.php.
Besides, shouldn't your root be C:\wamp\www\ in WAMP?
Upvotes: 3