Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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



4.4k
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