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

Hello Guys.

i have a problem in volt, I have a main template called frontend.volt and child page called index.volt

here is my code :

main template in app/views/layouts/frontend.volt

<head>
    <title>{% block title %}{% endblock %}</title>
</head>
<body>
             {% block content %}{% endblock %}
</body>

child page in app/views/guests/index.volt

{% extends "layouts/frontend.volt" %}
{% block title %} Register Guest {% endblock %}
{% block content %}
<form id="contact-form">
    <input id="form-name" type="text" placeholder="Name" />
    <input id="form-name" type="text" placeholder="Last Name" />
    <input id="form-email"  type="text" placeholder="Email Address" />  
    <input type="submit" class="form-button button left" />
</form>
{% endblock %}

and in the guests controller on its initialize function i set $this->view->setTemplateAfter('frontend');

but child page doesn't load whitin main template and just the main page load fine.

Try emptying the cache folder of Volt.

By default, Volt will create its processed file in the same folder the .volt file is in. If you have specified a "volt" folder for the processed templates, the file will be generated there.

Try setting the "compileAlways" flag for Volt to true also.

That might do the trick.