PHP - use includes for header, body and footer
Posted on 2014-09-19
I am new to PHP and bootstrap, but I managed to create a page that has a top navigation bar, such as the one on this page (logo and nav bar), then the body and at the bottom the footer. But right now this "page1.php" has all the code.
I am about to start doing many pages and I don't want to repeat this code on every page, I just want to add an 'include', so that when I do add that line of code then it calls the page and displays the top and bottom besides whatever code I have on the page.
What would the code be for that ?
"page1.php" would be the body
"top.php" would be the header and navigation bar
"footer.php" would be the footer.
If I take the code out of 'page1.php' and put it into 'top.php' and 'footer.php' ... what code would I need to add to 'page1/php' to call for the other two pages and for page1.php to know that they go at the top and bottom of the page.
I hope I explained myself properly.