@@ -647,25 +647,7 @@ But if you pass extra ones, they will be added to the URI as a query string::
647647Generating 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
670652Generating 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\C omponent\R outing\G enerator\U rlGeneratorInterface;
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