Skip to content

Instantly share code, notes, and snippets.

@danleyb2
Last active March 20, 2020 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danleyb2/34fadce946512011b015dba7c7cacbab to your computer and use it in GitHub Desktop.
Save danleyb2/34fadce946512011b015dba7c7cacbab to your computer and use it in GitHub Desktop.
Php Include Header and Footer from a root
<header>
<h1> This is the heading </h1>
</header>
<?php
// Define DOC_ROOT as index.php file directory
DEFINE('DOC_ROOT', dirname(__FILE__));
?>
<body>
<?php
include_once( DOC_ROOT.'/header.php');
?>
<p> This is the Body. </p>
<?php
include_once(DOC_ROOT.'/footer.php');
?>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment