- This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- The forum ‘Other’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
How to include html files using <!– #include ex1.html –>
and run on wamp.
How to include html files using <!– #include ex1.html –>
That’s an SSI directive. Does your web host support SSI? I’m not sure how common it is nowadays—most people use PHP for that sort of task.
I second @traq. Most people use PHP. PHP includes can be a great way to abstract content. It’s the easiest way that I can think of to keep markup clean and tidy. There are of course other ways and philosophies that achieve something similar. Python, more specifically Django comes to mind.
However… if you’re just doing a handful of includes, PHP is absolutely the way to go.
Hi guys thanks for the suggestion.
I am looking out for including html files..
I am having a header file and footer file separately .
I am trying to include header and footer to all content pages.
Deploying the code in wamp server.
Yes; we understand all that.
Assuming your server supports SSI, you also need to make sure your directives use HTML comment brackets (<!--
and -->
, not <!-
and ->
), and that you have no whitespace between the opening bracket and the directive. You also need to specify the file attribute name, not only its value:
<!--#include file="ex1.html" -->
(Also, I’m not sure if it is an artifact of the forum software, but your example uses en-dashes (–
; ASCII 226) rather than hyphens (-
; ASCII 45). Some browsers (incorrectly!) treat these as equivalent, but I have no idea if SSI will recognize them.)