You wrote:

>>
Using standards, which is the best way to achieve this:

1.   <!--#include virtual="/included.htm" -->

2.   <!--#include virtual="included.htm" -->

3.   <!--#include file="included.html" -->
>>

I don't think the way you include has anything to do with standards.
*What* you include does...that is, whatever you include will be rendered
by the server when the page is requested, and delivered to the browser. 

If the contents of your include are not valid, your page will not be
valid. And if you're a purist, you'll want to put the include call flush
left, and maintain your indents within the include file, so that the
generated code looks pretty too. :)

As to which is more correct? It depends on the server. Apache prefers
the virtual setting, while file is more typical for IIS. Relative paths
aren't enabled in IIS6 by default for security reasons. Both are happy
to include things within an include (e.g. include the SSI directive for
current year next to the copyright symbol in a footer include) but IIS
requires asp code to be included as an asp page, so that it is rendered
in the right order.

As has been mentioned, in the right environment you could also use php's
require or include.

But I do agree with the previous poster...the included file isn't (or
shouldn't be) an html file. It should be a text snippet of html with or
without other server directives. If you include an actual html file
complete with header/body elements you'll definitely have problems
validating. Most people use .txt, .inc, .ssi, or .asp* as extensions for
these files.  (*for IIS versions older than 6, because source code would
be shown in the browser if you typed in the include address, but not if
you used .asp)

SSI on Apache:
http://httpd.apache.org/docs/1.3/howto/ssi.html#whataressi

SSI on IIS:
http://en.wikibooks.org/wiki/Active_Server_Pages:Basic_ASP_Syntax

Jona
Web Services
ME&A
******************************************************
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