Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
Mustache_Loader_InlineLoader Class Reference
Inheritance diagram for Mustache_Loader_InlineLoader:
Mustache_Loader

Public Member Functions

 __construct ($fileName, $offset)
 The InlineLoader requires a filename and offset to process templates.
 
 load ($name)
 Load a Template by name.
 

Protected Member Functions

 loadTemplates ()
 Parse and load templates from the end of a source file.
 

Protected Attributes

 $fileName
 
 $offset
 
 $templates
 

Constructor & Destructor Documentation

◆ __construct()

Mustache_Loader_InlineLoader::__construct ( $fileName,
$offset )

The InlineLoader requires a filename and offset to process templates.

The magic constants __FILE__ and __COMPILER_HALT_OFFSET__ are usually perfectly suited to the job:

$loader = new Mustache_Loader_InlineLoader(__FILE__, __COMPILER_HALT_OFFSET__);

Note that this only works if the loader is instantiated inside the same file as the inline templates. If the templates are located in another file, it would be necessary to manually specify the filename and offset.

Parameters
string$fileNameThe file to parse for inline templates
int$offsetA string offset for the start of the templates. This usually coincides with the __halt_compiler call, and the __COMPILER_HALT_OFFSET__

Member Function Documentation

◆ load()

Mustache_Loader_InlineLoader::load ( $name)

Load a Template by name.

Exceptions
Mustache_Exception_UnknownTemplateExceptionIf a template file is not found
Parameters
string$name
Return values
stringMustache Template source

Implements Mustache_Loader.


The documentation for this class was generated from the following file: