You are reading the documentation for the v2.x version. Switch to the current version v1.x.

Twig namespaces

Last updated: Tue, 08 Jun 2021 00:39

You can use the twig namespace to separate templates or parts of your project.


Paths need to be declared in your configuration file like this:

    "twig": {
        "paths": {
            "foo": "{config: berlioz.directories.templates}/foo",
            "bar": "{config: berlioz.directories.templates}/bar"

Namespaces can be accessed by this notation:

$this->render('@foo/index.html', []);
$this->render('@bar/index.html', []);