Include a PHP file passing it all API variables and optionally your own specified variables
This is the procedural version of the $files->include()
method.
This is the same as PHP’s include()
function except for the following:
- It receives all API variables and optionally your custom variables
- If your filename is not absolute, it doesn’t look in PHP’s include path, only in the current dir.
- It only allows including files that are part of the PW installation: templates, core modules or site modules
- It will assume a “.php” extension if filename has no extension.
Note this function produces direct output. To retrieve output as a return value, use the
wireRenderFile()
or $files->render()
function instead.
Usage
// basic usage
$bool = wireIncludeFile (string $filename);
// usage with all arguments
$bool = wireIncludeFile (string $filename, array $vars = array, array $options = include);
Arguments
Name | Type(s) | Description |
---|---|---|
filename | string | Filename to include |
vars (optional) | array | Optional variables you want to hand to the include (associative array) |
options (optional) | array | Array of options to modify behavior:
|
Return value
bool
Always returns true
Exceptions
Method can throw exceptions on error:
WireException
- if file doesn’t exist or is not allowed
See Also
Functions methods and properties
API reference based on ProcessWire core version 3.0.236