Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other How to include html files using include .

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #165276
    gowda24
    Participant

    How to include html files using <!– #include ex1.html –>

    and run on wamp.

    #165334
    __
    Participant

    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.

    #165341
    nixnerd
    Participant

    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.

    #165348
    gowda24
    Participant

    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.

    #165349
    __
    Participant

    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.)

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Other’ is closed to new topics and replies.