2

I'm trying to include an html file within another html file. the include acts as a menu and footer. i'm using the current include syntax but my html data is not displaying on the page. my include files sit at the root. i've tried:

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

<html>
<head>
<title>test</title>
</head>
<body>


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

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


</body>
</html>

5 Answers 5

4

Check if your server has server-side includes (SSIs) enabled.

edit: Also, you should remove the first set of includes that come before the html tag - that's invalid.

Sign up to request clarification or add additional context in comments.

Comments

2

Apache webserver? Do you have "mod_include" enabled? Do you have either in .htaccess or httpd.conf the setting "Options +Includes" set?

Comments

1

Includes are server side, you'll need to save the main file as an .asp file and work with it on a server (assuming your server is ASP enabled, your syntax certainly makes that look as if it's the case).

Comments

1

a lot of info lays here: http://www.boutell.com/newfaq/creating/include.html, if it runs in the server i would go for <?php include("filename.html"); ?> since most of the servers also have php, if not you can always use .js P.S. i won't mentions html possible problems since other answers i think mentioned all i know...

Comments

0

The Netscape Navigator frames extension (cf. Wikipedia's Framing article) and its successors allow you to write HTML pages that reference other pages for inclusion. The browser then assembles the viewed page by making multiple HTTP requests. Note:

  1. It's a horrible way to serve up webpages: there's no well-behaved document model for it. But it is fairly well supported by browsers. So this answer is for information's sake, not a recommendation; and
  2. It creates viewed pages by juxtaposition, not inclusion, so it's not really what you were after, semantically speaking. But you can use it to solve your problem: the menu and footer bars are mini HTML pages that sit next to the page containing the main content.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.