|
Moodle PHP Documentation 4.5
Moodle 4.5.5+ (Build: 20250711) (ce34e8ff087)
|
Public Member Functions | |
| __construct ($baseDir, array $options=array()) | |
| Mustache production filesystem Loader constructor. | |
| load ($name) | |
| Load a Template by name. | |
Protected Member Functions | |
| getFileName ($name) | |
| Helper function for getting a Mustache template file name. | |
| loadFile ($name) | |
| Helper function for loading a Mustache file by name. | |
| shouldCheckPath () | |
| Only check if baseDir is a directory and requested templates are files if baseDir is using the filesystem stream wrapper. | |
| Mustache_Loader_ProductionFilesystemLoader::__construct | ( | $baseDir, | |
| array | $options = array() ) |
Mustache production filesystem Loader constructor.
Passing an $options array allows overriding certain Loader options during instantiation:
$options = array(
// The filename extension used for Mustache templates. Defaults to '.mustache'
'extension' => '.ms',
'stat_props' => array('size', 'mtime'),
);
Specifying 'stat_props' overrides the stat properties used to invalidate the template cache. By default, this uses 'mtime' and 'size', but this can be set to any of the properties supported by stat():
http://php.net/manual/en/function.stat.php
You can also disable filesystem stat entirely:
$options = array('stat_props' => null);
But with great power comes great responsibility. Namely, if you disable stat-based cache invalidation, YOU MUST CLEAR THE TEMPLATE CACHE YOURSELF when your templates change. Make it part of your build or deploy process so you don't forget!
| Mustache_Exception_RuntimeException | if $baseDir does not exist. |
| string | $baseDir | Base directory containing Mustache template files. |
| array | $options | Array of Loader options (default: array()) |
Reimplemented from Mustache_Loader_FilesystemLoader.
|
protectedinherited |
Helper function for getting a Mustache template file name.
| string | $name |
| string | Template file name |
|
inherited |
Load a Template by name.
$loader = new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views');
$loader->load('admin/dashboard'); // loads "./views/admin/dashboard.mustache";
| string | $name |
| string | Mustache Template source |
Implements Mustache_Loader.
Reimplemented in core\output\mustache_filesystem_loader.
|
protected |
Helper function for loading a Mustache file by name.
| Mustache_Exception_UnknownTemplateException | If a template file is not found. |
| string | $name |
| Mustache_Source | Mustache Template source |
Reimplemented from Mustache_Loader_FilesystemLoader.
|
protectedinherited |
Only check if baseDir is a directory and requested templates are files if baseDir is using the filesystem stream wrapper.
| bool | Whether to check is_dir and file_exists |