Skip to content

Commit fe9ec52

Browse files
committed
[#7844] add XML and PHP config examples
1 parent c4d0738 commit fe9ec52

File tree

1 file changed

+33
-5
lines changed

1 file changed

+33
-5
lines changed

configuration/override_dir_structure.rst

+33-5
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,40 @@ If your templates are not stored in the default ``app/Resources/views/``
9191
directory, use the :ref:`twig.paths <config-twig-paths>` configuration option to
9292
define your own templates directory (or directories):
9393

94-
.. code-block:: yaml
94+
.. configuration-block::
9595

96-
# app/config/config.yml
97-
twig:
98-
# ...
99-
paths: ["%kernel.root_dir%/../templates"]
96+
.. code-block:: yaml
97+
98+
# app/config/config.yml
99+
twig:
100+
# ...
101+
paths: ["%kernel.root_dir%/../templates"]
102+
103+
.. code-block:: xml
104+
105+
<!-- app/config/config.xml -->
106+
<?xml version="1.0" ?>
107+
<container xmlns="http://symfony.com/schema/dic/services"
108+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
109+
xmlns:twig="http://symfony.com/schema/dic/twig"
110+
xsi:schemaLocation="http://symfony.com/schema/dic/services
111+
http://symfony.com/schema/dic/services/services-1.0.xsd
112+
http://symfony.com/schema/dic/twig
113+
http://symfony.com/schema/dic/twig/twig-1.0.xsd">
114+
115+
<twig:config>
116+
<twig:path>%kernel.root_dir%/../templates</twig:path>
117+
</twig:config>
118+
</container>
119+
120+
.. code-block:: php
121+
122+
// app/config/config.php
123+
$container->loadFromExtension('twig', array(
124+
'paths' => array(
125+
'%kernel.root_dir%/../templates',
126+
),
127+
));
100128
101129
.. _override-web-dir:
102130

0 commit comments

Comments
 (0)