Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8870135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:38:55+00:00 2026-06-14T17:38:55+00:00

Seams that inheritance does not work in volt templates. Phalcon version is 0.6.1 Have

  • 0

Seams that inheritance does not work in volt templates.

Phalcon version is 0.6.1

Have a file structure:

  • views/
    • index/
      • index.html
    • layouts/
      • main.html
  • index.php

index.php:

<?php
    $di = new Phalcon\DI\FactoryDefault();
    $di->set('volt', function ($view, $di){
        return new Phalcon\Mvc\View\Engine\Volt($view, $di);
    });

    $view = new \Phalcon\Mvc\View();
    $view->setViewsDir("views/");
    $view->registerEngines(array(
        ".html" => 'volt'
    ));
    $view->setDi($di);
    $view->start();
    $view->render("index", 'index');
    $view->finish();
    echo $view->getContent();

views/index/index.html

{% extends "layouts/main.html" %}
{% block content %}
    <h2>Index</h2>
{% endblock %}

views/layout/main.html

<h1>Main</h1>
{% block content %}
    Not index
{% endblock %}

When I run php index.php I get:

Uncaught exception ‘Phalcon\Mvc\View\Exception’ with message ‘Template view to extend ‘layouts/main.html’ doesn’t exists’

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T17:38:56+00:00Added an answer on June 14, 2026 at 5:38 pm

    That comes from the fact that the application cannot find the file main.html in the actual path. If you add the full path it works, however it is inconvenient to do so.

    Something like this will work

    {% extends  "../views/layouts/main.html" %}
    

    or if your app is under app

    {% extends  "../app/views/layouts/main.html" %}
    

    I believe there should be a way to either reference the root path and/or the views path directly from Volt’s setup. That could very well be a NFR.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've seen some discussion on why c# does not implement multiple inheritance but very
I have some object classes that use inheritance. It seems that I can only
I have a class scheme with 2-levels of inheritance. My expectation is that each
It seems that it is not advisable to use <meta http-equiv=REFRESH CONTENT=3;url=url> for redirects
I've found something that appears to be a strange inheritance issue in PHP. From
Personally, I think inheritance is a great tool, that, when applied reasonably, can greatly
I'm not sure if this behavior is expected or not, but it seems that
I have a class ( MyClass ) that inherits most of its functionality from
I currently have a socket application that I use to send string back and
In java world (more precisely if you have no multiple inheritance/mixins) the rule of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.