Made dynamically-assigned layouts work with extending templates.

      When 'render' is invoked with both an 'extends' and a 'layout' clause, the
      layout is no longer ignored; the layout is used at the end of the template
      chain, unless a template hard-codes an alternative layout.