From 10dec727485e18573d4632cef0380b4220b4bd3f Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 27 Apr 2017 12:14:01 +0200 Subject: [PATCH] Explain how to override the default templates directory --- configuration/override_dir_structure.rst | 18 ++++++++++++++++++ reference/configuration/twig.rst | 2 ++ 2 files changed, 20 insertions(+) diff --git a/configuration/override_dir_structure.rst b/configuration/override_dir_structure.rst index bf24441d65b..3d51a34bd1d 100644 --- a/configuration/override_dir_structure.rst +++ b/configuration/override_dir_structure.rst @@ -15,6 +15,8 @@ directory structure is: │ ├─ cache/ │ ├─ config/ │ ├─ logs/ + │ ├─ Resources/ + │ │ └─ views/ │ └─ ... ├─ src/ │ └─ ... @@ -80,6 +82,22 @@ method:: Here you have changed the location of the directory to ``app/{environment}/logs``. +.. _override-templates-dir: + +Override the Templates Directory +-------------------------------- + +If your templates are not stored in the default ``app/Resources/views/`` +directory, use the :ref:`twig.paths ` configuration option to +define your own templates directory (or directories): + +.. code-block:: yaml + + # app/config/config.yml + twig: + # ... + paths: ["%kernel.root_dir%/../templates"] + .. _override-web-dir: Override the ``web`` Directory diff --git a/reference/configuration/twig.rst b/reference/configuration/twig.rst index 1da0bc8c2e3..2ccfb9dc718 100644 --- a/reference/configuration/twig.rst +++ b/reference/configuration/twig.rst @@ -246,6 +246,8 @@ on. Set it to ``0`` to disable all the optimizations. You can even enable or disable these optimizations selectively, as explained in the Twig documentation about `the optimizer extension`_. +.. _config-twig-paths: + paths ~~~~~