1

I'm having trouble finding decent docs on loading partials programmatically through Mustache.

I'm trying to load a login page with the form being a partial (it'll change depending on different user interactions).

PHP:

$m = new Mustache_Engine(array(
    'loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__) . '/views'),
    'partials_loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__) . '/views/login/partials')
));
$params = array();
$partials = array(
    'login_area' => 'login_form'
);
echo $m->render('login/login', $params, $partials);

Mustache:

<div id="login-area">
    {{> login_area}}
</div>

As I understand it, the $partials array should load my partial correctly.

However, I get no errors and nothing is displayed under {{> login_area}}

Is there a different way to do this?

Chris R.
  • 699
  • 8
  • 23
  • Ok, so looking at the `render` function, it only accepts 2 arguments, so this isn't the correct method. Not that I know what is, yet... – Chris R. May 04 '15 at 17:56
  • possible duplicate of [PHP Mustache 2.1 partial loading NOT based on the filename](http://stackoverflow.com/questions/14878970/php-mustache-2-1-partial-loading-not-based-on-the-filename) – bobthecow May 05 '15 at 09:34

0 Answers0