TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
These forums are read-only and for archival purposes only!
Please join our new forums at discourse.kohanaframework.org
Dynamic partials in using Kostache 4.0 on Kohana 3.3
  • I would like a scenario where I have {{>maincontent}} on my mustache template and I can change maincontent value from my controller. This was possible in the earlier version of Kostache as you could do $view->partial('maincontent', 'partials/edituser');

    How can I achieve this with the current Kostache version.

  • I want to keep the {{>maincontent}} and load different pages on the same partial segment based on which controller I am in. This allows me to have a general template and I simply inject the middle section for each different controller.

  • @churcho You need to write and define a custom partials loader for that. When you instantiate a new Mustache_Engine you need to pass your custom partials loader object to partials_loader. (in the constructor).

    This partials loader accepts an array in its constructor which then you need to parse and pass to the original file loader object. (partials loader class needs to extend this file loader class).

    It's a little bit complicated to explain, you need to know how the new Mustache engine works.

    I have a similar implementation to KOStache just for this reason, if you want I can send you some code (it's not online), I have to brush it up and make it composer friendly...

  • It's a little bit complicated to explain, you need to know how the new Mustache engine works.

    Yeah, this has nothing to do with KOstache, this is a "new" mustache.php thing.

  • Thanks for the links @faketegy. Works perfectly.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion