$cache→renderFile()  
Render a file as a ProcessWire template file and cache the output
This method is similar to the $files->render() method and actually delegates the file
rendering to that method (when creating the cache). The important difference is that this
method caches the output according to WireCache rules for the $expire argument, rather
than re-rendering the file on every call.
If there are any changes to the source file $filename the cache will be automatically
re-created, regardless of what is specified for the $expire argument.
Available since version 3.0.130.
Example
// render primary nav from site/templates/partials/primary-nav.php
// and cache for 3600 seconds (1 hour)
echo $cache->renderFile('partials/primary-nav.php', 3600);Usage
// basic usage
$string = $cache->renderFile(string $filename);
// usage with all arguments
$string = $cache->renderFile(string $filename, $expire = null, array $options = []);Arguments
| Name | Type(s) | Description | 
|---|---|---|
| $filename | string | Filename to render (typically PHP file).
Can be full path/file, or dir/file relative to current work directory (which is typically /site/templates/).
If providing a file relative to current dir, it should not start with "/".
File must be somewhere within site/templates/, site/modules/ or wire/modules/, or provide your own  | 
| $expire(optional) | intPagestringnull | Lifetime of this cache, in seconds, OR one of the following: 
 | 
| $options(optional) | array | Accepts all options for the  
 | 
Return value
string boolRendered template file or boolean false on fatal error (and throwExceptions disabled)
Exceptions
Method can throw exceptions on error:
- WireException- if given file doesn’t exist
See Also
API reference based on ProcessWire core version 3.0.252