phpphalconvolt

volt : pass variable to include from parent template


I am beginner with volt ,

I have a template that use a partials like this

main.volt

<div>
  hello to 
  {{ partial("partials/tst",["name":"kevin"]) }}
</div>

and I use that variable like this partial/tst.volt

<b>
{{name}}
</b>

but I get an error like this

Undefined variable

how can I fix this ??


Solution

  • This code are ok, I test it and get correct name in the view:

    Index file capture

    I have the partial like you:

    Partial code capture

    And finally I get this in my view:
    view result