Archived video

This video is archived and won't be updated. We're keeping it online for now as a courtesy.

Alternate resources: 

Twig Layouts and Template Inheritance in Symfony 3

Video loading...

Transcript language code: 

Join Drupalize.Me to watch this video

Join today and gain instant access to our entire video library.

Log in Sign up
  • 0:08
    To get a layout,
  • 0:09
    add a new Do Something tag at the top of show.html.twig.
  • 0:16
    extends 'base.html.twig'.
  • 0:20
    This says that we want base.html.twig to be our base template.
  • 0:25
    But where does that file live?
  • 0:28
    Remember, all templates live in app/Resources/views.
  • 0:31
    And look, there's base.html.twig.
  • 0:35
    This little file actually came with Symfony and it's yours to customize.
  • 0:39
    Refresh the browser after just this small change.
  • 0:43
    Nice, a huge error.

Twig Layouts and Template Inheritance in Symfony 3


In this lesson, you'll learn how to dress up the plain HTML that's being output in your Symfony app with a template layout using Twig's template inheritance feature. You'll learn how to use both block and extends Twig keywords to create, use, and re-use HTML layouts in your app. To explore more features in Twig, head over to the Twig Templating series.

Log in or sign up to download companion files.
Additional resources: