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

Use Volt to compile form templates

Hey there!

I have a very simple issue but I could not find anything about it (or it was just me).

I have created some custom form elements which extending the default elements provided by Phalcon, I overwritted the render method to render form elements with my styles.

The problem is the HTML is now harcoded to elements code, I would put them to template .volt files and when I call render function it would call and compile the .volt template which was binded to element.

I'm using partials for this purpose, which you can render like this:

class SomeController {
    public function someAction() {
        $html = $this->view->getPartial('template_file',[
            'some' => $variable,
        ]);
    }
}