如何在volt中使用模型(How to use the model in volt)



12.8k

我建议您 Google,这应该不是什么高难度的操作。



5.4k

A model object or results you could assign using $this->view->setVar("modelresult", $modelObjectOrObjects); Then the variable is accessible in volt for loops for example. But you wouldn't like to do in volt something like this Modelclass::findFirst()... even if it was possible because this is to be done in the controller. Am i right?



5.4k

Maybe it will be helful. https://docs.phalconphp.com/en/latest/reference/volt.html#for

{% for robot in robots %} <li>{{ robot.name|e }}</li> {% endfor %}

现在在学习,先放弃VOLT模板学习其他的技术, 模板这块主要是各种生成组件。 优势也好也不好。