meder omuraliev meder omuraliev - 3 months ago 10
PHP Question

Change default template to 'common.volt'?

From what I understand, Phalcon uses

index.phtml
or
index.volt
in
app/views
as the base template for any page that doesn't have a template specified.

How can I change this to use
app/views/layouts/common.volt
?

Answer

When setting up the view component we need to declare $view Object like the following:

$di->set('view', function () use ($config) {

    $view = new View();

    $view->setViewsDir($config->application->viewsDir);
    $view->setLayout('common');
......

using setLayout(String name) method to set default layout for app

Comments