I get a MustacheException [ 3 ]: Unknown partial: header when I use {{> header }}
Is there anything else I have to do to use partials? How do I tell mustache where to find the partials?
To answer my own question:-
The parser package calls parser()->render($template, $data) but mustache php requires partials to be passed as a third argument.
So out of the box it seems that partials cannot be used with the Fuel implementation.
To get round this I have overridden View_Mustache and passed the partials as $data, extracted them in the overridden process_file method and then called parser()->render($template, $data, $partials).
I am only taking a first look at FuelPHP so I may be completely on the wrong tack.
FuelPHP includes an old (v0.7.1) version of mustache.php.
In version 0.9.0 the ability to use a partial loader was added.
I have downloaded the latest version of mustache.php (1.1.0) and put the files Mustache.php and MustacheLoader.php in the packages/parser/vendor/Mustache directory.
I have copied packages/parser/classes/view/mustache.php to app/classes/view and made the following changes
added
include PKGPATH.'parser'.DS.'vendor'.DS.'Mustache'.DS.'MustacheLoader.php';
replaced
$result = static::parser()->render(file_get_contents($file), $this->_data);
with
$_loader = new MustacheLoader(APPPATH.'/views');
$result = static::parser()->render(file_get_contents($file), $this->_data, $_loader);
$this_data contains the replacement values for the main template and the partials.