+ 3

Can I reference a html file inside html?

I want to make a website and have a header/footer, I was wondering if I could write it once in one file and call it in another

23rd Sep 2018, 7:34 PM
Jack
Jack - avatar
7 ответов
+ 3
In additional to Toni Isotalo's answer: <?php include"file.html"?> or <?php fopen"file.html?> file.html Your code to call, can either be php, js, txt, xml, json etc..etc.. extensions Personally I use always include: https://secure.php.net/manual/en/function.include.php Edit: Make your main file .php, since .html will not work with php code unless it is a .php extension. html will work in .php extensions
23rd Sep 2018, 8:05 PM
🌴Vincent Berger🌴
🌴Vincent Berger🌴 - avatar
+ 3
You can do it with HTML <frame> or <iframe> tags. You can do it with a host scripting language like PHP or ASP. You can do it with a Java Applet within HTML. Or you can do it with JavaScript within HTML.
24th Sep 2018, 4:22 AM
Ronen Gil רונן גיל رونين جيل 🏳️‍🌈♾🇹🇩🇮🇱
Ronen Gil רונן גיל رونين جيل 🏳️‍🌈♾🇹🇩🇮🇱 - avatar
+ 2
Not with html but I always do that with php or even better with laravel.
23rd Sep 2018, 7:40 PM
Toni Isotalo
Toni Isotalo - avatar
24th Sep 2018, 2:55 AM
Emerson Prado
Emerson Prado - avatar
+ 1
y'all beat me to the iframes
24th Sep 2018, 6:08 PM
iJustErik gah
iJustErik gah - avatar
0
Ofcourse
25th Sep 2018, 12:45 PM
Joshua Martin Fontanilla
Joshua Martin Fontanilla - avatar
- 2
href="/yourwebsite.html"
26th Sep 2018, 10:55 AM
Douwe Osinga
Douwe Osinga - avatar