I'm creating a simple static site generator for my small HTML blog site for educational reasons and I'm having a little trouble. I have a few .html files that need to be updated from time to time and decided to create a .php file that allows me to push a button and loop through all .html files applying the new code to the beginning of each .html file.
The new HTML code is located inside a .txt file called "header.txt". The loop should copy the new HTML from the "header.txt" file and apply it to each .html file, but only overwriting the exact number of lines as was found in the "header.txt" file, no more no less.
I've got the .php coded except for the button's code that will start the process of updating the files. That is the part I need help with. I tried a few different ways of embedding foreach and for loops with no success.