The best way to download content that should appear on every page

So far I have used the tag <iframe>to upload things like headers / footers / navigators to my web page. They cause so much trouble, although when I was going to start building a new site, I thought that now I will sort it.

I thought about all the html code in the php file and just loading it dynamically. Ideally, I would like the code to become part of the page. Therefore, it appears in the line. But I also want to be able to edit one file if I need to change one bit, and not edit the same file 100 times.

<iframe>did it well until recently, and I don't want to use workarounds to solve my problems. Can someone please write some code that I could adapt or post a link to something that tells me how to do this? Greetings

+5
source share
2 answers

You can use the PHP function include()to include elements such as headers and footers on your pages.

So:

include('header.php'); 

., will search for a file called header.php in the same directory and include it in your page. Then you just need to write this at the top of your pages.

, . , ?

+4

All Articles