I’ve run into this issue countless times. And I am not even a full-time web developer. I do this for fun. But the absence of this feature is blatantly obvious. Or is it just me? Let’s explore!
HTML5 is awesome
To the point
In all these years though, I’ve been missing a feature in HTML that to me is a no-brainer addition. But as I questioned in the intro: Is it just me?
Maybe this feature would take away a chunk of what PHP is good for. Because to work around this missing feature I — and possibly many of you — turn to PHP.
Why is this feature “missing”?
Here’s the problem: I’ve created a cool header, a nice little menu, and a footer. And what do I have to do to create another page? Right, copy all those HTML elements over to the privacy.html file. And only change the main content area in between. You see where I’m going with this, don’t you?
Sure, it’s no real hassle. Copying and pasting don’t take much time. This is not the issue, though, is it? What if I change a small detail in the footer? I’d have to remember to change it in both HTML files. Still do-able. But now picture having a handful of pages, or even dozens. Do you really want to copy and paste every small change to all these files manually? I don’t.
It baffles me that HTML never had — and as it looks like never will have — a simple include dynamic to reference parts of or whole HTML files from another HTML file.
You know, a simple
for example. This way, we could design our headers, footers, menus, sidebars, and add them to our main content, however many main content files we need.
Quick PHP fix
Includes are not a real issue, of course. PHP offers a simple and quick solution for exactly that problem. You just rename your files to .php and and add an include function to your index file that references header, footer, menu, etc.
<?php include "./header.php" ?>
<?php include "./menu.php" ?>
<?php include "./footer.php" ?>
What it boils down to
We can solve anything in modern web development. The sky’s the limit. A quick PHP fix is all we need to work around this missing feature.
Still, there is something about native HTML, the purity and beauty of plain HTML, that has me wishing for an include feature with basic web markup language. Is that just me?