I am trying to work with the include statement in php, including a php file that assumes a footer. However, I get error messages saying
"include (includes / footer.php): could not open the stream: there is no such file or directory in"
OR
"Warning: include (): Failed opening 'includes / footer.php' to enable (include_path = '; C: \ php \ pear') . " I don’t know if I missed something or do I need to do something else while extracting the file from another folder? Here is the code
include.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../css/style.css"/>
<title>include</title>
<style type="text/css">
.foot-item{width:33.33% min-height:120px; border-right:solid 1px white; }
.foot-item:nth-last-child{ border-right:none;}
.foot-item h3 a{color:#0099ff; text-decoration:none;}
</style>
</head>
<body>
<div class="contain">
<article>
<header><h1>include</h1></header>
<section>
<blockquote>The include statement includes and evaluates the specified file. </blockquote>
<p>Default</p>
<div id="result">Result</div>
<?php
?>
</section>
</article>
<?php include('includes/footer.php');?>
</div>
</body>
</html>
includes / footer.php
<footer>
<div class="foot-item">
<h3><a href="#">Recent Posts</a></h3>
<ul><li>link<li><li>link<li><li>link<li></ul>
</div>
<div class="foot-item">
<h3><a href="#">Free Newsletters</a></h3>
<ul><li>link<li><li>link<li><li>link<li></ul>
</div>
<div class="foot-item">
<h3><a href="#">Social Links</a></h3>
<ul><li>link<li><li>link<li><li>link<li></ul>
</div>
</footer>
source
share