Monster RA Posted December 31, 2020 Share Posted December 31, 2020 Hi All, I've seen that in PHP you can include a require or include function which saves you from having to add the entire code for headers and footers for each page. Does a similar things exist in HTML? If so, please direct me. Thanks in advance Russell Link to comment Share on other sites More sharing options...
niche Posted December 31, 2020 Share Posted December 31, 2020 (edited) No. Edit: Here's how I think about the scripting languages I use: HTML is all about displaying the data/message, so the spiders can decide what's there. CSS makes the data/message look pretty with some functionality. Javascript gives the data/message all the functionality it will ever need. MySQL gets and stores the data/message and shows the foundation of how to begin to think about specific data. PHP describes the thinking behind the data/message in detail. GIT is how 1000s of people work together on the data/message and avoid stepping on toes, ideally. This is meant to be just my conception of code and how I use it. Feel free to take it, leave it or modify it any way that makes more sense to you! And... Have the Best New Year Ever! Edited December 31, 2020 by niche Link to comment Share on other sites More sharing options...
dsonesuk Posted December 31, 2020 Share Posted December 31, 2020 You can use javascript to include html such as headers and footers, but i generally use php include. https://www.w3schools.com/howto/howto_html_include.asp Link to comment Share on other sites More sharing options...
niche Posted December 31, 2020 Share Posted December 31, 2020 I'll have to try that! Never came across that. Link to comment Share on other sites More sharing options...
Monster RA Posted January 1, 2021 Author Share Posted January 1, 2021 On 12/31/2020 at 3:34 PM, niche said: No. Edit: Here's how I think about the scripting languages I use: HTML is all about displaying the data/message, so the spiders can decide what's there. CSS makes the data/message look pretty with some functionality. Javascript gives the data/message all the functionality it will ever need. MySQL gets and stores the data/message and shows the foundation of how to begin to think about specific data. PHP describes the thinking behind the data/message in detail. GIT is how 1000s of people work together on the data/message and avoid stepping on toes, ideally. This is meant to be just my conception of code and how I use it. Feel free to take it, leave it or modify it any way that makes more sense to you! And... Have the Best New Year Ever! Thank you that is very helpful. When starting out, it's incredibly overwhelming but to conceptualise as you have is very useful. I have opted to save my files on to a local server using XAMPP and then to save each .html file as a .php. This seems to have to done the trip as I can now use the 'include' function. Link to comment Share on other sites More sharing options...
Monster RA Posted January 1, 2021 Author Share Posted January 1, 2021 On 12/31/2020 at 6:08 PM, dsonesuk said: You can use javascript to include html such as headers and footers, but i generally use php include. https://www.w3schools.com/howto/howto_html_include.asp Yes, php seems the preferable method, though it requires a local server, which isn't a bad thing I suppose. Link to comment Share on other sites More sharing options...
melahi Posted January 29, 2021 Share Posted January 29, 2021 On 1/1/2021 at 3:55 AM, Monster RA said: Hi All, I've seen that in PHP you can include a require or include function which saves you from having to add the entire code for headers and footers for each page. Does a similar things exist in HTML? If so, please direct me. Thanks in advance Russell Actually you can use server side includes in straight HTML, but you have to enable it. I've never used it myself as I just use PhP, but I saw a tutorial for it here: https://www.yourhtmlsource.com/sitemanagement/includes.html Link to comment Share on other sites More sharing options...
Ingolme Posted January 30, 2021 Share Posted January 30, 2021 I don't think anybody uses server-side includes anymore, since server-side programming languages do that and a whole lot more, and both solutions require having a server configured to execute instructions in the HTML document. Link to comment Share on other sites More sharing options...
frankosport19 Posted February 14, 2021 Share Posted February 14, 2021 (edited) Discovered the JavaScript-powered HTML include process here at W3 Schools almost two years ago, and it has worked very well for me. I've tested the code in Firefox, Pale Moon, Opera, Chrome and MS-Edge (Windows versions only), and it hasn't failed in any of those yet. Be aware that your desktop, laptop or notebook must have a local server running so that you can see the code working as desired before you publish your content. Currently, I am using the Laragon Apache Server. A modest sample of how I have used the JS-HTML include -- Calendar for the Year 2021. In examining the source code, be sure to note the remarks I have inserted at vital places. BTW -- The reference to the XAMPP local server can be ignored, as you may be using that you like better. BTW -- I've programmed with HTML, CSS, and Javascript but have never used PHP. Thanx-A-Lot. Stay Safe and Well. Edited February 14, 2021 by frankosport19 Adding Example Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now