Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
c2d55598
Commit
c2d55598
authored
Dec 17, 2011
by
COil
Committed by
Fabien Potencier
May 24, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added a Twig example for the service
parent
76f82f20
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
doc/providers/url_generator.rst
doc/providers/url_generator.rst
+16
-0
No files found.
doc/providers/url_generator.rst
View file @
c2d55598
...
...
@@ -47,3 +47,19 @@ The UrlGenerator provider provides a ``url_generator`` service::
' | '.
'<a href="'.$app['url_generator']->generate('hello', array('name' => 'Igor')).'">Hello Igor</a>';
});
When using Twig, the service can be used like this::
.. code-block:: jinja
{{ app.url_generator.generate('homepage') }}
Moreover, if you register the ``SymfonyBridgesServiceProvider``, then you will have access to the native Twig helpers: ``path()`` and ``url()``::
.. code-block:: jinja
{{ path('homepage') }}
{{ 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>`.
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment