Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Executing fuelphp functions in mthaml/twig template.
  • Hello. I added parser package with mthaml/twig template support.

    My question is how can i run fuelphp functions in those templates ? At example i want to echo Form::open() function

    I tried it like this:

    %body
      .example_div
      = {% Form::open() %}

    but it does not works, and shows error:

    Twig_Error_Syntax [ Error ]: A hash key must be a quoted string, a
    number, a name, or an expression enclosed in parentheses (unexpected
    token "operator" of value "%" in "login.twig" at line 13
  • SyntaxlbSyntaxlb
    Accepted Answer
    Hi, 

    You can use Twig Extension. The package parser already include an extension with some useful Fuelphp's functions. ( parser/classes/twig/fuel/extension.php )

    If u want to execute Form::open, u can do in twig :

    {{ form_open() }}

Howdy, Stranger!

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

In this Discussion