is a term used to refer to a plain-text document. A flat file is a non-parsed
document (such as a simple HTML document, or text file), as far as the server is concerned.
As with the inclusion of LXP documents, the
inclusion method does not require a
closing tag, and should therefore be used as an empty-element tag with a trailing slash. To include a flat file, open an
LXP region, and use the following syntax where
is the name of the file you wish
If the flat file you are including has a recognized file extension, you may force it to be displayed literally by
using the method="flat" attribute. Example 13-22
demonstrates an LXP document which includes three HTML files, from a relative directory called
to be used as a header, sidebar, and footer. Since their extensions do not imply any more complex method, the files are
included as-is in the main document.
Example 13-22. Including flat files
<include src="parts/header.html" />
<include src="parts/leftbar.html" />
Welcome to my home page.<br />
<include src="parts/footer.html />
As you can see, this sort of inclusion can make web sites with consistent themes far easier to maintain by
modularizing components in a manner similar to what is done when using server-side-includes or PHP's
readfile() function. In addition, flat file inclusion allows you to achieve this modularity without
having to leave the simplicity and elegance of mark-up design. This is certainly not the full extent of the
tag's power, as you will find out in subsequent sections.