I have index.html.twig and base.html.twig in the same directory folder..I have the following scipts
index.html.twig
{% extends('base.html.twig') %}
{% block body %}
helo body
{{ parent() }}
{% endblock %}
{% block footer %}
This footer
{% endblock %}
base.html.twig
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>{% block title %}Welcome!{% endblock %}</title>
{% block stylesheets %}{% endblock %}
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
</head>
<body>
{% block body %}The body block{% endblock %}
{% block sidebar %}The body sidebar{% endblock %}
</body>
</html>
It returns me with an error "Unable to find template "base.html.twig" in "FacebookBundle:Default:index.html.twig" .I also noticed some people have used :: just before the template name .. Why is that and how do I fix this ?
You'll have to extend FacebookBundle:Default:base.html.twig
in your index.html.twig
.
You use ::
when you put your template directly in the view/
dir and not in a sub dir (i.e.: for layout in this example: Bundle::layout.html.twig
instead of Bundle:Controller:index.html.twig
)
Bundle
Resources
views
Controller
index.html.twig
Default
base.html.twig
index.html.twig
layout.html.twig
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With