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

Volt Inheritance Problem

I have set layout folder in module configuration file as

$view->setLayoutsDir('../../common/layouts/');

and then layout set as

$view->setLayout('main');

It works fine but I want to do inheritence for that I created base.volt file inside common/layouts folder and modify main.volt as

{% extends "base.volt" %}

but it gives me error as

Template file /var/www/html/projectName/apps/modules/home/views/base.volt does not exist

NOTE:- in above error home is module name and common layout is differenet folder



5.7k
Accepted
answer
edited Apr '15

Have you tried this?

{% extends "../../common/layouts/base.volt" %}

The docs state the following under this section multiple-inheritance:

As partials, the path set to “extends” is a relative path under the current views directory (i.e. app/views/).

So each extends, in your case of a module project, it will always default to your .../app/modules/{module_name}/views directory

working thnx steven