Content:Virtual versus File Include

From Earlham CS Department
Revision as of 11:49, 3 April 2009 by Kay (talk | contribs) (New page: Both <code>include virtual</code> and <code>include file</code> are examples of server side includes (SSIs). When the webserver is serving a page to a client, and it sees an include, it t...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Both include virtual and include file are examples of server side includes (SSIs). When the webserver is serving a page to a client, and it sees an include, it takes the code from the included file and "pastes" it into the file that it's serving. The only difference between the two is how you specify the path to the file.

They look something like this:

<!-- #include virtual="/includes/header.html" --> 
                     or
<!-- #include file="../../includes/header.html" -->

Include Virtual

When including a virtual, specify it from the webroot, that is, the "virtual filesystem" that the website resides on. Because of this, it is impossible to access files outside of the web document tree.

Include File

When including a file, specify the path from the directory where the parent page resides.