Skip to content

Commit 96db622

Browse files
committed
Removing duplicated description of the Twig path/url functions
1 parent 6b01d5e commit 96db622

File tree

1 file changed

+1
-42
lines changed

1 file changed

+1
-42
lines changed

routing.rst

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -647,25 +647,7 @@ But if you pass extra ones, they will be added to the URI as a query string::
647647
Generating URLs from a Template
648648
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
649649

650-
The most common place to generate a URL is from within a template when linking
651-
between pages in your application. This is done just as before, but using
652-
the ``path()`` function to generate a relative URL:
653-
654-
.. configuration-block::
655-
656-
.. code-block:: html+twig
657-
658-
<a href="{{ path('blog_show', {'slug': 'my-blog-post'}) }}">
659-
Read this blog post.
660-
</a>
661-
662-
.. code-block:: html+php
663-
664-
<a href="<?php echo $view['router']->generate('blog_show', array(
665-
'slug' => 'my-blog-post',
666-
)) ?>">
667-
Read this blog post.
668-
</a>
650+
To generate URLs inside Twig, see the templating chapter: :ref:`book-templating-pages`.
669651

670652
Generating URLs in JavaScript
671653
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -717,29 +699,6 @@ method::
717699
$this->generateUrl('blog_show', array('slug' => 'my-blog-post'), UrlGeneratorInterface::ABSOLUTE_URL);
718700
// http://www.example.com/blog/my-blog-post
719701

720-
From a template, in Twig, use the ``url()`` function (which generates an absolute URL)
721-
rather than the ``path()`` function (which generates a relative URL):
722-
723-
.. configuration-block::
724-
725-
.. code-block:: html+twig
726-
727-
<a href="{{ url('blog_show', {'slug': 'my-blog-post'}) }}">
728-
Read this blog post.
729-
</a>
730-
731-
.. code-block:: html+php
732-
733-
<?php
734-
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
735-
?>
736-
737-
<a href="<?php echo $view['router']->generate('blog_show', array(
738-
'slug' => 'my-blog-post',
739-
), UrlGeneratorInterface::ABSOLUTE_URL) ?>">
740-
Read this blog post.
741-
</a>
742-
743702
.. note::
744703

745704
The host that's used when generating an absolute URL is automatically

0 commit comments

Comments
 (0)