Help - Search - Members - Calendar
Full Version: around the include
HTMLHelp Forums > Web Authoring > Cascading Style Sheets
otacon
ok I am looking to see if there is a way around the ssi/asp way of including a html document to everypage of my web site.

so I found this online

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Template - Header, Indexer, Footer</title>
<script src="header.html" type="text/html"></script>
<script src="indexer.html" type="text/html"></script>
<script src="footer.html" type="text/html"></script>
</head>

<body>

<div id="header">
<!-- innerHTML inserted by header.html -->
</div>

<div id="indexer">
<!-- innerHTML inserted by indexer.html -->
</div>

<div id="footer">
<!-- innerHTML inserted by footer.html -->
</div>

</body>


</html>

I am not much of a css person so could anyone explain how/if I can make this work.

it was originally like this:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Template - Header, Indexer, Footer</title>
<script src="header.js" type="text/js"></script>
<script src="indexer.js" type="text/js"></script>
<script src="footer.jsl" type="text/js"></script>
</head>

<body>

<div id="header">
<!-- innerHTML inserted by header.js -->
</div>

<div id="indexer">
<!-- innerHTML inserted by indexer.js -->
</div>

<div id="footer">
<!-- innerHTML inserted by footer.js -->
</div>

</body>


</html>

Christian J
It looks like you're inserting content from external javascript files, just that you changed them to .html extensions in the first example (which may or may not work in a browser).

Note that javascript is not indexed by search engines (there might be a few exceptions) and some browsers may not support it (or their users don't want to run it), so server-side includes are much more robust.
pandy
What's the difference? laugh.gif

I guess you pasted the same code twice by mistake and your question is if you should use "JavaScript includes" instead of real ones? NO! You should not! You COULD if you don't care about disabled people, people who turn JS off and search engines...

If you can't use any kind of server side technique where you are hosted and don't want to change host, I'd recommend that you do the processing on your local machine and upload the static pages that result from this. It's just advanced Find and Replace and there are special programs for this.
pandy
QUOTE(Christian J @ Dec 7 2006, 11:57 PM) *

It looks like you're inserting content from external javascript files, just that you changed them to .html extensions in the first example (which may or may not work in a browser).

Duh. wacko.gif
otacon
I guess my problem is that it doesn't seem to work

i am completely new at css
and was wondering if you guys could show me how to get this to work.

I am trying to make it include the html from header.html in the middle of index.html






Darin McGrew
Please see the FAQ entry How do I include one file in another?
pandy
QUOTE(otacon @ Dec 8 2006, 05:58 AM) *

i am completely new at css


You don't use any CSS and CSS can't do this anyway... Did you mean SSI?

JavaScript can do it, but as said it's a bad choice. Can't say why it doesn't work since we don't see the actual JS...

You should use SSI (or PHP or whatever). See Darin's link for that. Or, if you can't, pre-process the pages locally and then upload them.
Ton v H
QUOTE(pandy @ Dec 7 2006, 09:03 PM) *

... I'd recommend that you do the processing on your local machine and upload the static pages that result from this. It's just advanced Find and Replace and there are special programs for this.

I'm interested in these special programs. Do you have any suggestions?
pandy
See the link Darin posted. You may find more easy to use ones with Google. It's been a while, so I can't recommend any special program.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.