From 8bdf02ad7d565221bc5ca629d701ee4e6509190b Mon Sep 17 00:00:00 2001 From: nikic <+@ni-po.com> Date: Wed, 29 Dec 2010 18:45:22 +0100 Subject: [PATCH] update include doc to use hashes and the current Environment API --- doc/templates.rst | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/templates.rst b/doc/templates.rst index 5a4457b..589e799 100644 --- a/doc/templates.rst +++ b/doc/templates.rst @@ -794,7 +794,7 @@ You can add additional variables by passing them after the ``with`` keyword: .. code-block:: jinja {# the foo template will have access to the variables from the current context and the foo one #} - {% include 'foo' with ['foo': 'bar'] %} + {% include 'foo' with {'foo': 'bar'} %} {% set vars = {'foo': 'bar'} %} {% include 'foo' with vars %} @@ -804,7 +804,7 @@ You can disable access to the context by appending the ``only`` keyword: .. code-block:: jinja {# only the foo variable will be accessible #} - {% include 'foo' with ['foo': 'bar'] only %} + {% include 'foo' with {'foo': 'bar'} only %} .. code-block:: jinja @@ -828,14 +828,14 @@ The template name can be any valid Twig expression: {% include some_var %} {% include ajax ? 'ajax.html' : 'not_ajax.html' %} -And if the variable evaluates to a ``Twig_Template`` object, Twig will use it +And if the expression evaluates to a ``Twig_Template`` object, Twig will use it directly:: // {% include template %} $template = $twig->loadTemplate('some_template.twig'); - $twig->display('template.twig', array('template' => $template)); + $twig->loadTemplate('template.twig')->display(array('template' => $template)); Import ~~~~~~ -- 1.7.2.5