The heart of LXP's content management is its content inclusion workhorse: the
<include> tag. The <include> tag can operate
in one of many ways, depending either on the explicit value of the method attribute with
which it is initiated, or the implicit context determined by its attributes.
The <include> tag can be used, in its simplest form, to simply include a flat
HTML file, such as a standard header, sidebar, and footer. In its more advanced incarnations, the
<include> tag can be used to parse token-delimited files by using arbitrary tokens,
parse basic XML documents, embed PHP output inline within the LXP document, make direct SQL queries, and, of course, include
other LXP documents.
Table 13-1 lists each of the LXP inclusion methods available to the
<include> tag. The method in the first column is value that you supply to the
<include> tag's method attribute. The alias in the second column describes any
alternative names that you can use to invoke the same method. The "Implied by" column shows any attribute values which would
imply a method (bypassing the need for an explicit method attribute), and the "Description"
column gives a brief description of the method itself.
Table 13-1. LXP inclusion methods
Method
|
Aliases
|
Implied by
|
Description
|
LXP
|
|
.lxp
extension ending src attribute
|
Processes the source file through
mod_lxp
|
flat
|
|
Unrecognized extension in src attribute, and no sql or query attribute
|
Displays a file's literal contents
|
parsed
|
�
|
�
|
Parses a token-delimited file, and breaks it up into accessible <field> values
|
XML
|
RSS, RDF
|
.xml
,
.rdf
or
.rss
extension at the end of the src attribute
|
Parses a well-formed XML file, and breaks it up into accessible <field> values
|
local
|
Apache
|
.php
,
.php3
, or
.phtml
extension at the end of the src attribute
|
Displays output of an Apache subrequest with a src attribute describing a system filename
|
URI
|
�
|
�
|
Displays output of an Apache subrequest with a src attribute describing an HTTP URI
|
SQL
|
�
|
Existence of sql or query attribute
|
Executes a SQL statement, making query results accessible both as variables, and with the <field> tag
|
The source of content inclusion is invariably defined in the src attribute of the
<include> tag. In most cases this is a system filename, though it may describe a
database source or Apache URI request, depending on the method. When you include a file described by a relative path (one
that is not explicitly defined from the root of the filesystem), LXP will use the working directory of the LXP document
which is performing the inclusion.
Note: To prevent accidental infinite recursion (e.g., including a file that includes itself), LXP documents may only
include to the depth specified in the
lxp.conf
file's
MaxIncludeDepth directive (see the Section called Nuts and Bolts: Configuring lxp.conf
"). The default maximum include
depth is 15.