Simple problem I have so far always solved via PHP:
You have a site with header, menu, footer and content field.
Header, menu and footer are usually the same for each page.
So that for example you don't have ten pages (like home.html, products.html, about.html, ..) all having a copy of the static header and menu in their html files. Now if you want to change the header you have to change ten files.
I hope I made my question clear enough, if not please leave a comment :)
If you're using Apache, you can use server-side includes. These basically provide include statements within HTML documents.
Install and enable mod_include. Configure
Options +Includes
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
Use .shtml as your main page file extension. Then in your pages, you can do things like
<!--#include virtual="/header.html" -->
Nginx also supports server-side includes with it's SSI module:
location / {
ssi on;
}
HTML:
<!--# include file="header.html" -->
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With