April 2016
Intermediate to advanced
290 pages
5h 51m
English
A good base template shouldn't have anything other than blocks. This means that if you have a class name or ID name defined in your base template, then you need to reconsider your structure. Yes, your code still works but it does not follow the best practices. Remember, a base template is supposed to define the structure only. So, all styling or functional-related contents should be kept in the children templates that extend the base.
Keeping this in mind, let's modify the default base template a little:
{# app/Resources/views/base.html.twig #} <!DOCTYPE html> <html> <head> <meta charset="UTF-8"/> <title>{% block title %}{% endblock %}</title> {% block head %}{% endblock %} </head> <body> {% block navigation %}{% endblock %} ...Read now
Unlock full access