Pretty much as explained by the title: I am building different pages for a website. All of the pages will have a menu bar on the left at fixed position.
There are two ways that I can approach this:
Create a Insert menubar function to insert the menu bar for every pages
Create a home.php with the menu bar, and nest other pages in an iframe
I have already done things using the first method and now the requirement is for me to implement the second approach.
Using includes as felgall suggests is the way to keep consistent elements such as navigations headers and footers in one place but included on all pages.
Includes are what first drew me to php. I was sick of copying and pasting a menu into multiple html files every time I added or removed a page from the site.
You may start out only using the odd include here and there, but it can lead to you trying harder stuff.
I had already been using includes in my pages for a long time before I started using PHP. You don’t need PHP if all you want is includes. You can use Server Side Includes without using any server side language if all you want are includes.
Of course a server side language like PHP provides for lots of other things and not just includes.
Initially all I wanted was includes, but I never found a way to do that without php. But I don’t regret turning to php at all, as I soon saw the potential of what else I could do with it. Now I couldn’t be without it.