@@ -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: `ref-framework-assets-version `.
114
+ :ref: `book-templating-assets `. For asset versioning,
115
+ see :ref: `ref-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
@@ -384,8 +362,8 @@ information in :ref:`book-templating-pages`.
384
362
absolute_url
385
363
~~~~~~~~~~~~
386
364
387
- .. versionadded :: 2.6
388
- The ``absolute_url `` function was introduced in Symfony 2.7
365
+ .. versionadded :: 2.7
366
+ The ``absolute_url() `` function was introduced in Symfony 2.7.
389
367
390
368
.. code-block :: jinja
391
369
@@ -394,18 +372,22 @@ absolute_url
394
372
``path ``
395
373
**type **: ``string ``
396
374
397
- Returns the absolute URL for the given absolute path. This is useful to convert
398
- an existing path :
375
+ Returns the absolute URL from the passed relative path. Assume the following
376
+ code was used to render `` http://example.com/sub/list.html `` :
399
377
400
378
.. code-block :: jinja
401
379
402
- {{ absolute_url(asset(path)) }}
380
+ {{ absolute_url('/human.txt') }}
381
+ {# http://example.com/human.txt #}
382
+
383
+ {{ absolute_url('something.png') }}
384
+ {# http://example.com/sub/something.png #}
403
385
404
386
relative_path
405
387
~~~~~~~~~~~~~
406
388
407
- .. versionadded :: 2.6
408
- The ``relative_path `` function was introduced in Symfony 2.7
389
+ .. versionadded :: 2.7
390
+ The ``relative_path() `` function was introduced in Symfony 2.7.
409
391
410
392
.. code-block :: jinja
411
393
@@ -414,10 +396,16 @@ relative_path
414
396
``path ``
415
397
**type **: ``string ``
416
398
417
- Returns a relative path for the given absolute path (based on the current
418
- request path). For instance, if the current path is
419
- ``/article/news/welcome.html ``, the relative path for ``/article/image.png `` is
420
- ``../images.png ``.
399
+ Returns the relative path from the passed absolute URL. Assume the following
400
+ code was used to render ``http://example.com/sub/list.html ``:
401
+
402
+ .. code-block :: jinja
403
+
404
+ {{ relative_path('http://example.com/human.txt') }}
405
+ {# ../human.txt #}
406
+
407
+ {{ relative_path('http://example.com/sub/something.png') }}
408
+ {# something.png #}
421
409
422
410
expression
423
411
~~~~~~~~~~
0 commit comments