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 load template from one directory and page from another

I have a multi module app (based on Mruz's base app). Each module has it's own views directory in /module_name/views/. However, I want to be able to share a main layout template between modules. The main layout template view would be at /common/views/.

Last time I looked into doing this on Phalcon 1.03 it didn't seem to be possible. Is there a way of doing now?

You have to add the relative path to your layouts and main view in bootstrap when you define the view component

$view->setLayoutsDir('relative/path/to/layouts/');
$view->setPartialsDir('relative/path/to/partials/');
$view->setMainView('relative/path/to/index');

https://docs.phalcon.io/en/latest/api/Phalcon_Mvc_View.html