i have a variable in my blade that its set to the blade in controller
$this->view->->setVar("formData", $formData);
my formData is an array from my submitted form
now i want to define a new variable in? my volt blade and assign my formData to it. how should i do that?
i read phalcon(https://docs.phalcon.io/3.4/en/volt) volt document but i cant find how should i do that.
In your controller
setVar()andsetVars()can be used on theviewobject to set your variables and then use them in your Volt file:and in the template
If
$datais an array and you want elements from it:If
$datais an object you can call methods on itIf you want to perform comparisons and assign variables in the template:
References:
https://docs.phalcon.io/4.0/en/volt#variables
https://docs.phalcon.io/4.0/en/volt#assignments
https://docs.phalcon.io/4.0/en/volt#if