I have a simiar problem.
Firstly a bit of background about my level of abiliy. I'm self-taught at HTML, got my head around that and CSS and have been able to create a website from scratch by just typing code. However PHP is something new to me, I'm a novice at scrpting, so I'm not looking for anything too complicated.
I manage a site with a number of pages, each page is unique, but shares some identical elements, such as the header, menu, footer and a few other bits. The site is all hand written by myself in HTML. But, for example, if I want to add a page and then add it to the menu, I have to edit the menu section for every page.
I am lead to believe the with PHP you can make this process easier and only need to make the edit to common site elements once. But I do not know the best way to achieve this. I have been experimenting and, with my limited PHP knowledge came up with a way that works to an extent. But there are one or two things I can't get to work, and I'm not sure if this way is best practice or the most efficient way to do this, since I couldn't find an on-line "how to" and just made this up from stuff I could find in PHP tutorials. So I would like some expert adivce on this.
What I did was this: I saved a HTML page as PHP. Where there was a common element such as the menu, I replaced it with some PHP which Opens, Reads and Echos a file which contains the code for the menu. If I replace the menu on all pages, I only need to edit the one file with the menu code, and all pages see the same change. It works, but is this the best way?
One thing I could not get to work was each page's unique header image. The pages all start like this, an identical header, a unique header image, then idential menu, followed by unique content, finishing with an identical footer.
I thought I could put the first part (header, header image and menu) into one common file for all pages, and set a unique string on each page to set the name of the unique header image, then put that string in the code in the common file, but I can't get it to work.
Can anyone advise?