3

I have got standard Extend in Twig file:

{% extends 'AcmeMyBundle:Layout:defaultLayout.html.twig' %}

Can I call this template file by relative name of bundle? eg.

{% extends '.:Layout:defaultLayout.html.twig' %}
            ^
            // relative 'dot'

Like in dir paths: "./relative/path/to/file.ext"

123qwe
  • 1,525
  • 1
  • 14
  • 16

1 Answers1

3

Just edit Config.yml file:

# app/config/config.yml
twig:
    # ...
    paths:
        "%kernel.root_dir%/../src/acme/myBundle/Resources/views": foo_bar

And then you can have got access to relative path - you can simply change the path in config.yml instead in every include lines.

# view.html.twig
{% include '@foo_bar/Layout/defaultLayout.twig' %}
123qwe
  • 1,525
  • 1
  • 14
  • 16