Search code examples
phpnetbeans-8

Web page shows the following error


Created a folder called Coffe website. Saved this folder in xampp/htdocs. Gave the project url as localhost/xampp/Coffewebsite. Netbeans connector is active in chrome. It says web_page is not_available.

Error messages:

Warning: include(Template.php): failed to open stream: No such file or directory in D:\xampp setup\htdocs\Coffe website\index.php on line 5

Warning: include(): Failed opening 'Template.php' for inclusion (include_path='.;D:\xampp setup\php\PEAR') in D:\xampp setup\htdocs\Coffe website\index.php on line 5.

index.php:

<?php
$title="Home";
$content="Hello world";
include 'Templates.php' //to link this page to our templates 
?>

Templates.php:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title> <?php echo $title; ?> </title>
</head>
<body>
    <div id="wrapper">
        <div id="banner"></div>
        <nav id="navigation">
            <ul id="nav">
                <li><a href="index.php"> Home </a></li>
                <li><a href="#">Coffee</a></li>
                <li><a href="#">Shop</a></li>
                <li><a href="#">About</a></li>
            </ul>
        </nav>
        <div id="content area">
            <?php echo $content; ?>
        </div>
        <div id="sidebar"> </div>
        <footer> <p> All rights received </p> </footer>
    </body>
</html>

Solution

  • " failed to open stream: No such file or directory"

    It does mean your script is unable to access the file Template.php in the current directory ;) Check your path