I am trying to get a raw template that is already loaded by Mustache_Engine
. On creation of the mustache object Filesystem_Loader
instance is set up and pointing to the default directory.
$mustache = new Mustache_Engine( array(
'loader' => new Mustache_Loader_FilesystemLoader( 'path-to-templates' )
) );
And later, for rendering the templates I use.
echo $mustache->render( 'template-name', $data );
The same template is used by mustache.js
on server side, so i want to also print that template as inline script.
I could load the template from the filesystem manually with file_get_contents
, but since that template is already loaded maybe there's a way to retrieve that from Mustache_Engine. Also, to use the file_get_contents
i must use full path of the template and that just contradicts with the purpose of Mustache Template Loader.