Ceesjan
Ceesjan

Reputation: 15

Symfony 4 set Twig template path in controller

I searched everywhere but unfortunately without result. The case is as following: I'm using a general Symfony 4 codebase with basic TWIG template files. Next to that i have multiple domains who refer to the codebase, because of that reason I want to set the path to my TWIG files in the controller from my codebase: return $this->render("path/to/domain/and/twig/temp", "domain variables");

This is not working and I can't find how to change my TWIG path withing my controller. Can somebody help with this?

Thanks!

Upvotes: 0

Views: 1924

Answers (1)

Zamir
Zamir

Reputation: 441

Symfony uses app/Resources/views/ directory for templates. If you want to change you can configure it in config.yml as below.

twig:
    # ...
    paths: ["%kernel.project_dir%/templates"]

Upvotes: 2

Related Questions