You can do it by using include_once()
function in php. Construct a header part in the name of header.php
and construct the footer part by footer.php
. Finally include all the content in one file.
For example:
header.php
<html>
<title>
<link href="sample.css">
footer.php
</html>
So the final files look like
include_once("header.php")
body content(The body content changes based on the file dynamically)
include_once("footer.php")