Skip to content

Instantly share code, notes, and snippets.

@meskarune
Created September 12, 2012 00:27
Show Gist options
  • Select an option

  • Save meskarune/3703264 to your computer and use it in GitHub Desktop.

Select an option

Save meskarune/3703264 to your computer and use it in GitHub Desktop.
Include one html file in another
#PHP include one html file in another
1. Save the HTML for the common elements of your site to separate files. For example, your navigation section might be saved as navigation.html or navigation.php.
2. Use the following PHP code to include that HTML in each page.
<?php
require($DOCUMENT_ROOT . "path to file/include-file.html");
?>
3. Use that same code on every page that you want to include the file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment