Skip to content

Commit 10dec72

Browse files
committed
Explain how to override the default templates directory
1 parent 280d0e8 commit 10dec72

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

configuration/override_dir_structure.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ directory structure is:
1515
│ ├─ cache/
1616
│ ├─ config/
1717
│ ├─ logs/
18+
│ ├─ Resources/
19+
│ │ └─ views/
1820
│ └─ ...
1921
├─ src/
2022
│ └─ ...
@@ -80,6 +82,22 @@ method::
8082

8183
Here you have changed the location of the directory to ``app/{environment}/logs``.
8284

85+
.. _override-templates-dir:
86+
87+
Override the Templates Directory
88+
--------------------------------
89+
90+
If your templates are not stored in the default ``app/Resources/views/``
91+
directory, use the :ref:`twig.paths <config-twig-paths>` configuration option to
92+
define your own templates directory (or directories):
93+
94+
.. code-block:: yaml
95+
96+
# app/config/config.yml
97+
twig:
98+
# ...
99+
paths: ["%kernel.root_dir%/../templates"]
100+
83101
.. _override-web-dir:
84102

85103
Override the ``web`` Directory

reference/configuration/twig.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ on. Set it to ``0`` to disable all the optimizations. You can even enable or
246246
disable these optimizations selectively, as explained in the Twig documentation
247247
about `the optimizer extension`_.
248248

249+
.. _config-twig-paths:
250+
249251
paths
250252
~~~~~
251253

0 commit comments

Comments
 (0)