0

I installed parser package for fuelphp to have mthaml (https://github.com/arnaud-lb/MtHaml) support in templates. So I created a tamplate and I don't understand how can I run fuelphp helper functions in the mthaml templates.

I'm running haml/twig templates

At example:

{% haml %}
!!!
%body
  .login-box

   = Form::open('/test/')

Will show error:

An opened parenthesis is not properly closed. Unexpected token "punctuation" of value ":" ("punctuation" expected with value ")") in "login.twig" at line 6

So question is How can I run fuelphp functions inside the mthaml templates? Echoing array elements or strings with = array.some_value or = string works fine.

bump.

user991
  • 1,339
  • 2
  • 24
  • 45
  • It looks like you are using MtHaml/Twig: any *code* (e.g. anything after `=`) should be valid Twig code. So you can run anything that would be valid in Twig too. `Form::open()` looks like PHP syntax. – Arnaud Le Blanc Jul 28 '13 at 17:11
  • So how can i run Form::open() function in mthaml/twig template, because = {% Form::open() %} doesn't works. – user991 Jul 29 '13 at 07:45
  • In Twig you have to use `{{ form_open() }}`, since the Parser package extends Twig to support Fuel's numerous methods, and Form::open is aliased form_open. Take a look at `fuel/packages/parser/classes/twig/fuel/extension.php`, you will find all available functions. You won't be able to run any PHP code in MtHaml/Twig mode, that would be MtHaml/PHP, but I think Fuel does not support it out of the box. – Tamás Barta Oct 24 '13 at 12:21

0 Answers0