@@ -111,7 +111,8 @@ asset
111
111
112
112
Returns a public path to ``path ``, which takes into account the base path
113
113
set for the package and the URL path. More information in
114
- :ref: `book-templating-assets `. For asset versioning, see :ref: `reference-framework-assets-version `.
114
+ :ref: `book-templating-assets `. For asset versioning, see
115
+ :ref: `reference-framework-assets-version `.
115
116
116
117
assets_version
117
118
~~~~~~~~~~~~~~
@@ -126,29 +127,6 @@ assets_version
126
127
Returns the current version of the package, more information in
127
128
:ref: `book-templating-assets `.
128
129
129
- absolute_url
130
- ~~~~~~~~~~~~
131
-
132
- .. code-block :: jinja
133
-
134
- {{ absolute_url(asset(path, packageName)) }}
135
-
136
- ``path ``
137
- **type **: ``string ``
138
- ``packageName ``
139
- **type **: ``string `` | ``null `` **default **: ``null ``
140
-
141
- Returns the absolute URL that corresponds to the given asset path and package.
142
- More information in :ref: `book-templating-assets `. For configuring the base URLs,
143
- :ref: `ref-framework-assets-base-urls `.
144
-
145
- The absolute URLs generated with this function ignore the asset versioning.
146
- Combine it with the ``assets_version() `` function to append the version number:
147
-
148
- .. code-block :: jinja
149
-
150
- {{ absolute_url(asset('logo.png')) ~ '?' ~ assets_version('images') }}
151
-
152
130
form
153
131
~~~~
154
132
@@ -385,8 +363,8 @@ information in :ref:`book-templating-pages`.
385
363
absolute_url
386
364
~~~~~~~~~~~~
387
365
388
- .. versionadded :: 2.6
389
- The ``absolute_url `` function was introduced in Symfony 2.7
366
+ .. versionadded :: 2.7
367
+ The ``absolute_url() `` function was introduced in Symfony 2.7.
390
368
391
369
.. code-block :: jinja
392
370
@@ -395,18 +373,23 @@ absolute_url
395
373
``path ``
396
374
**type **: ``string ``
397
375
398
- Returns the absolute URL for the given absolute path. This is useful to convert
399
- an existing path:
376
+ Returns the absolute URL from the passed relative path. For example, assume
377
+ you're on the following page in your app:
378
+ ``http://example.com/products/hover-board ``.
400
379
401
380
.. code-block :: jinja
402
381
403
- {{ absolute_url(asset(path)) }}
382
+ {{ absolute_url('/human.txt') }}
383
+ {# http://example.com/human.txt #}
384
+
385
+ {{ absolute_url('products_icon.png') }}
386
+ {# http://example.com/products/products_icon.png #}
404
387
405
388
relative_path
406
389
~~~~~~~~~~~~~
407
390
408
- .. versionadded :: 2.6
409
- The ``relative_path `` function was introduced in Symfony 2.7
391
+ .. versionadded :: 2.7
392
+ The ``relative_path() `` function was introduced in Symfony 2.7.
410
393
411
394
.. code-block :: jinja
412
395
@@ -415,10 +398,17 @@ relative_path
415
398
``path ``
416
399
**type **: ``string ``
417
400
418
- Returns a relative path for the given absolute path (based on the current
419
- request path). For instance, if the current path is
420
- ``/article/news/welcome.html ``, the relative path for ``/article/image.png `` is
421
- ``../images.png ``.
401
+ Returns the relative path from the passed absolute URL. For example, assume
402
+ you're on the following page in your app:
403
+ ``http://example.com/products/hover-board ``.
404
+
405
+ .. code-block :: jinja
406
+
407
+ {{ relative_path('http://example.com/human.txt') }}
408
+ {# ../human.txt #}
409
+
410
+ {{ relative_path('http://example.com/products/products_icon.png') }}
411
+ {# products_icon.png #}
422
412
423
413
expression
424
414
~~~~~~~~~~
0 commit comments