Commit f480b609 authored by Fabien Potencier's avatar Fabien Potencier

tweaked previous commit (closes #219)

parent c2d55598
...@@ -48,18 +48,19 @@ The UrlGenerator provider provides a ``url_generator`` service:: ...@@ -48,18 +48,19 @@ The UrlGenerator provider provides a ``url_generator`` service::
'<a href="'.$app['url_generator']->generate('hello', array('name' => 'Igor')).'">Hello Igor</a>'; '<a href="'.$app['url_generator']->generate('hello', array('name' => 'Igor')).'">Hello Igor</a>';
}); });
When using Twig, the service can be used like this:
When using Twig, the service can be used like this::
.. code-block:: jinja .. code-block:: jinja
{{ app.url_generator.generate('homepage') }} {{ app.url_generator.generate('homepage') }}
Moreover, if you register the ``SymfonyBridgesServiceProvider``, then you will have access to the native Twig helpers: ``path()`` and ``url()``:: Moreover, if you register the ``SymfonyBridgesServiceProvider``, then you will
have access to the ``path()`` and ``url()`` functions:
.. code-block:: jinja .. code-block:: jinja
{{ path('homepage') }} {{ path('homepage') }}
{{ url('homepage') }} {# generates the absolute url http://example.org/ #} {{ url('homepage') }} {# generates the absolute url http://example.org/ #}
You can find more information about this subject in the :doc:`Symfony bridges documentation<symfony_bridges>`. You can find more information about this subject in the :doc:`Symfony bridges
\ No newline at end of file documentation <symfony_bridges>`.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment