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

multi module shared layout extends main.volt

How do I extend my view to the main layout that is outside the module I' am using https://github.com/phalcon/mvc/tree/master/multiple-shared-layouts, skeleton and I want to extends the main shared layout like this:

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

{% block content %}

    this works!

{% endblock %}

and my main layout is:

<html>
    <head>
        <title>Common Layout</title>
    </head>
    <body>
            {% block content %}
            {% endblock %}
    </body>
</html>
edited Jan '15

you can use /views/controller/action.volt

<div class="container">
  This loads first
</div>

then in /views/layouts/layout.volt you can put

<div class="containerwrapper">
  {{ content() }}
</div>

the it can load /views/index.volt (in root of views)

<html>
<head>
</head>
<body>
 {{ content() }}
</body>
</html>

And it will put all three together in order

You can also set what layout it will use in the controller, below would be /view/layouts/public.volt

$this->view->setTemplateBefore('public');