2

i have a header in a separate file with header.html and i want to include it to another file index.html after head section for this i had used

<!--#include virtual="header.html"-->

and unfortunately it was not running then i used

<!--#include virtual="header.shtml"-->

by saving my file as header.shtml

so can anybody please give me any suggestion

Thankyou

NOTE:I am being using smarty and PHP so using appache server

2 Answers2

0

Include another HTML file in a HTML file

OR

(#include file="footer.html")

OR

$("#header").load("header.html");

Community
  • 1
  • 1
Nimesh Vagadiya
  • 602
  • 3
  • 8
  • 18
0
  • As you are Using WAMP Server, Check whether Your Server SSI(Server Side Includes) is enabled or not. If not, enable it by editing the configuration file. Following page contains tutorial on Setting Up SSI on WAMP.

  • Use <!--#include virtual="header.html" -->

    Instead of

    <!--#include virtual="header.html"-->

    Apache tutorial on SSI stipulates the format requires a space character before the "-->" that closes the element.

  • Also, Where are you adding <!--#include virtual="header.html" --> , statement? The statement should be within <html> tag.

    <html>
    <head>
    <title>My Title</title>
    </head>
    <body>
    
         <!--#include virtual="header.html" -->
    
     </body>
     </html>
    
  • Make sure index.html and header.html files are in Same Directory. If not try to use relative path.

  • Following page contains a lot of issues and common mistakes on include virtual directive.

    If it doesn't work at all, then try to go for <?php include("header.html"); ?> .

Ritesh Kumar Gupta
  • 5,055
  • 7
  • 45
  • 71