I am trying to use PHP's include function in conjunction with html but it is not working. I'm just messing around with the tag, it seems to be very simple but i cannot figure out why it is not working...
here is the template.php page:
<!DOCTYPE html>
<html>
<head>
<title>Template</title>
<link href="css/layout.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div id="wrapper">
<?php
include ("include/header.php");
include ("include/leftcolumn.php");
include ("include/rightcolumn.php");
include ("include/footer.php");
?>
</div>
</body>
</html>
and here is the header.php page that I am trying to include:
<header>
<p>Header.</p>
</header>
The only thing i could think of is the wrong directory, I have an include folder which is where the header.php is and referenced that in the include tag...unless I'm wrong, any tips? Thanks
I didn't tested your code, but be sure of your path (is your template.php file to the root, before your include folder?) (it's crazy to say, but pathing are a frequent problem, and it can easily making you mad)
Or, try this syntax too : include
'include/footer.php';
Remove Space
http://php.net/manual/en/function.include.php you dont need to use parenthesis try :
and make sure the paths correct.
edit:
every exemple on the php manuel are dont have parenthesis.
And a question. where exectly you try to execute your php file. just in a browser or using any wamp server aplication to simulate server side action for your php ?