To include an external content-type configured within Apache, the <include>
tag can be invoked with either the URI or local method.
Each performs a subrequest to Apache, meaning that the inclusion is processed as if it is a direct request to Apache, with
the output embedded at the location of the <include> tag in the LXP
document.
The difference between these two methods is that the URI method accepts a
src attribute of the form that Apache would literally accept from a web browser, prefixed
with a forward-slash, and beginning at the document root directory of the configured host (e.g.,
/example.php
). Alternatively, the local method tells Apache directly
where the file is located on the local filesystem (e.g.,
/home/web/default/example.php
).
Example 13-26 shows an LXP file which includes a PHP script in two ways. Note that
each of these methods goes through Apache, and will thus be reliant on Apache to be properly configured for the requested
content type, and especially in the case of the local method, have the necessary rights
on the directory containing the included script.
Example 13-26. Including other content types
<lxp>
An example PHP script:<br />
<include src="/example.php" method="URI" />
<hr />
The same PHP script, using the local method:<br />
<include src="/home/web/default/example.php" method="local" />
</lxp>
Omitting the method attribute when including a document (specified by the a
src attribute) with a name ending with any of the common PHP extensions
(
.php
,
.php3
, and
.phtml
) results in the method being
implied as local. As of LXP 0.8, however, there is no way to imply the
URI method. You must therefore specify method="URI" to
use the URI method.