I have a small question regarding HTML. If let's suppose I have 3 pages: Home, About Us, and Contact Us. If I have a lot of content script on my Home.html file and would like to have the same content replicated on my About Us.html file such as header area and footer let's say, do I have to copy and paste the entire script to the About Us.html file excluding the body section which usually differs? That would take a lot of time if I have over 50 pages. And what if I had to fix something in the Home.html file, I will also have to alter these changes manually on every single page. I think that would be very time-consuming. Is there any alternative option for this issue?
Asked
Active
Viewed 30 times
0
-
What technology stack are you using. – Mata Prasad Chauhan Jan 05 '18 at 11:58
-
You can use javascript v.gr. to include the header and the footer from another file. – Pierre François Jan 05 '18 at 11:58
-
I don't know if it's a good method, but if you can use php or other server languages, you can create a 'header.php' file in which you put your header, and include this file in your pages – bachinblack Jan 05 '18 at 11:58
-
Scripts in separate files. Then import them in all HTML files. – Sergio Tx Jan 05 '18 at 11:58
-
You need to use `master-page` concept. – Abhishek Pandey Jan 05 '18 at 11:59
-
Thx for all of your suggestions. That is what i was thinking. – blanky Jan 05 '18 at 12:00
-
Another way is to use Ajax to dynamically change page content without redirecting user. It's an easy way for page updates and will look nicer too – Vaxo Basilidze Jan 05 '18 at 12:01
-
Is it only HTML or any server side technology you will be using? If its only HTML look for shtml (Server enable needed). Otherwise server side all technologies have user controls or partial views for this purpose. – Sunil Jan 05 '18 at 12:01
-
@Sunil — If someone picks HTML from "HTML or any server side technology", then Server Side Includes are not an option because that's a server side technology! – Quentin Jan 05 '18 at 12:02
-
using only HTML. will look deeper into shtml. – blanky Jan 05 '18 at 12:05