Thursday, October 04, 2018

PHP - File Path Technique

Example of file path techniques. Breaking a few part from a index.php

1. header.php
2. footer.php
3. index.php

→ header.php
<!-- Header Page -->

<!doctype html>

<html lang="en">
  <head>
    <title>eSeong Page</title>
    <meta charset="utf-8">
  </head>

  <body>
    <header>
      <h1>Welcome to eSeong Page</h1>
    </header>

    <navigation>
      <ul>
        <li><a href="index.php">Home</a></li>
      </ul>
    </navigation> 
 → footer.php
<!-- Footer Page -->
<footer>
  &copy; <?php echo date('Y'); ?> eSeong
</footer>

</body>
</html>
 → index.php
<!-- Index Page -->
<?php include('header.php'); ?>

<div id="content">
</div>

<?php include('footer.php'); ?>
Preview page as below :
 → http://foodwall.asia/eSeong/filepath/

If you can't get the page working, please let me know the error in comment.
Post a Comment