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.

Problema inheritance Volt

I have created a volt inheritance, but doesn't work

/views/index.volt
<!DOCTYPE html>
<html>
    <head>
        {% block head %}
        {% endblock %}
    </head>

    <body>
      {% block content %}
      {% endblock %}
    </body>
</html>

/views/index/index.volt
{% extends "index.volt" %}

{% block head %}
  <title>Page Title</title>
{% endblock %}


{% block content %}
  <h1>Page Child</h1>
  text
{% endblock %}

This displays

<!DOCTYPE html>
<html>
    <head>


    </head>

    <body>


    </body>
</html>

What is wrong?



36.4k
Accepted
answer

Hi

You try disable main layout

$view->disableLevel([View::LEVEL_MAIN_LAYOUT => true, View::LEVEL_LAYOUT => true]);

See more https://github.com/phanbook/phanbook/blob/master/core/config/services.php#L173

Works perfectly, thanks ;)

Hi

You try disable main layout

```php $view->disableLevel([View::LEVELMAINLAYOUT => true, View::LEVEL_LAYOUT => true]); ``` See more https://github.com/phanbook/phanbook/blob/master/core/config/services.php#L173