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
Pass variable to function from mustache/kostache
  • Is this possible? stackoverflow has that answer but I guess that's when using the .js

    Is it possible to have this on Kohana where I can call methods from my view and pass parameters in Kostache?

  • I think it should work: Hello, {{#caps }}{{ text }}{{/ caps }}! $m = new Mustache_Engine(array( 'helpers' => array( 'caps' => function() {return function($text, $m) { return strtoupper($m->render($text)); }} ) ));

  • Yes that works:

    public function i18n()
        return function($value)
            return I18n::get($value);
    {{#i18n}}Translate me{{/i18n}}

Howdy, Stranger!

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

In this Discussion