phalconvolt

Phalcon How to change template extension from phtml on html


I will want to change template extension from .phtml to .html, but my attempts has failed.

$this->view->registerEngines([
    'html'
]);

Solution

  • You forgot the . before html file extension. Try like this:

    // View
    $di->setShared('view', function() use ($di) {
        $view = new \Phalcon\Mvc\View();
        $view->registerEngines([
            '.yourextension' => function($view, $di) {
                ...
                ...
                ...
            }
        ]);
        return $view;
    });
    

    Just tested with .qq extension and it worked as intended.