Hi Paul and Khwaja,

Thanks for your replys. I just ran across another method for including a file into HTML. It involves using an XMLHttpRequest Object <http://developer.apple.com/internet/webcontent/xmlhttpreq.html>. I ran across an article about it here: http://developer.apple.com/internet/webcontent/xmlhttpreq.html

I think it's interesting that a method developed by MircoSoft for an ActiveX extension is being discussed in a site for Apple developers.

The method requires that you detect the kind of browser and create an XMLHttpRequest Object base on whether the browser is Internet Explorer or Mozilla based. From what I understand of the article this seems to be making a request in JavaScript (or ActiveX) for the server to send more information to the browser. The browser assumes the new file is XML and interprets it to HTML.

The article says the W3C is considering a standard for the XMLHttpRequest Object.

While the method has several drawbacks, it does allow the developer a method of including a file into the HTML from client side as opposed to .ASP, .NET, .JSP, or Perl which are all server side solutions.



Carl



Paul Novitski wrote:

At 02:14 PM 1/13/05, Carl Reynolds wrote:

If I have a section of HTML that is the same in all my files, is there a way to put it in a file by itself and include it into each page?



Carl,

Here are two ways (I'll be interested to learn about others):

1) Use a server-side scripting language such as ASP, Perl, or PHP to include component files into one downloaded page. ASP can do this either with the #INCLUDE directive or through file I/O using the FileSystemObject object, and I'm sure the other server-side scripting languages have comparable methods.

2) Use a JavaScript inclusion directive in your HTML headers, e.g.:

        <script type="text/javascript" src="navmenu.js"></script>

...in which navmenu.js contains something like this:

        var navMenu = '<ul>
                <li><a href="aardvark.html">Aardvark</a></li>
                <li><a href="bananafish.html">Bananafish</a></li>
        </ul>'

...and then write the value of navMenu into your document structure.

Paul
******************************************************
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
******************************************************




Salman, Khwaja wrote:

Yes, carl you can definately inlude an HTML File or any file in an ASP
file. Yes, I think the HTML file cannot include the another HTML file.
Theritically it is possible but due to some technical reasons this is
not possile.

However, from Javsscript it is possilbe to read a file and then
document.write that htm into you htm file. But the dependency is that
if the browser has no support for java script or if the javascript is
disabled, then this appraoch fails.

The last approach that you have is to used the include directive in an
ASP file. If possible use the file name as ASP, because this way,
there is less chance that the dowload managers will actually download
the whole source, instead they download the processed page.

How to include, the include directive is

<!--#include="FilePAth"-->

The file path can be absolute or a relative patj

Hope that helps

Salman


Wrom: RZFSQHYUCDDJBLVLMHAALPTCXLYRWTQTIPWIGYOKSTTZR Date: Thu, 13 Jan 2005 17:14:33 -0500 Subject: Re: [WSG] Two CSS Question



Salman,

I'm glad you asked about including, I have wondered that myself. I would
like to add another question to yours: If I have a section of HTML that
is the same in all my files, is there a way to put it in a file by
itself and include it into each page?

As far as your question #2 goes: are you talking about something like

#id { width: 100%; }
-- It's the attitude that determines the altitude of flight Salman, Khwaja Tech Writer - Halcyon.



****************************************************** The discussion list for http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
******************************************************



Reply via email to