Reputation: 571
I am not using Wordpress. I am simply making a website locally with HTML/CSS/Javascript. My client has asked me to "add a simple link to the footer navigation" but I have a whole bunch of pages and they're each individual HTML files.
Is there any way to make ONE footer file (while not using CMS systems) and then inject that footer over all these pages with a hook? That way, I can make one change to one file and have it update all the HTML pages versus changing them all, one by one?
Thank you!!!
Upvotes: 1
Views: 379
Reputation: 546
Ideally, you should use the PHP include_once function (providing PHP is installed on your workstation/server).
You would then create a file called footer.php and that file would simply contain the HTML which creates the footer.
Then, on the bottom of each page, remove the HTML footer and add:
<?php include_once("footer.php"); ?>
That will then include the footer HTML once. Then, when you make an edit to the footer.php file, the change will show site-wide.
Upvotes: 1
Reputation: 724
I'm probably going to get some hate for this and I highly don't suggest this route, but if you don't want to go through the whole loading through JS route and you know the dimensions of your footer, you can use an iframe.
Upvotes: 0
Reputation: 8057
I would not advise it, but you could do it with JavaScript: create a JavaScript file with the function which writes footer. You still would need to include the JavaScript file and the function call on every page.
Upvotes: 0