We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

variable in include Volt template

Hi,

I am new to phalcon and was trying to make a widget page with the volt template engine. When i do {% include "widgets/main/personal.volt" %} the personal widget will be loaded, but when i do {% include widget.widgeturl %} i get the error that my volt template doesn't exist. (the widget.widgeturl gets from a mysql database.) wamp\www\public/../app/views/widgets/main/personal.volt' was not found in the views directory

is it possible to use these variables with a include or do i have to use an other option?

Greets, Vincent



98.9k
Accepted
answer

Hi, the template name in widget.widgeturl must not contain the .volt extension that's why the partial cannot be loaded

Thanks, it works. I like the writing style of phalcon clean and fast :)



712

It will be good to document this somewhere, because it is very much not obviouse!

https://docs.phalcon.io/en/latest/reference/volt.html#include How more obvious should it get? ;]

It will be good to document this somewhere, because it is very much not obviouse!