File tree Expand file tree Collapse file tree 3 files changed +102
-71
lines changed
Filter options
components/templating/helpers Expand file tree Collapse file tree 3 files changed +102
-71
lines changed
Original file line number Diff line number Diff line change @@ -1007,6 +1007,25 @@ If you need absolute URLs for assets, you can set the third argument (or the
1007
1007
1008
1008
<img src="<?php echo $view['assets']->getUrl('images/logo.png', null, true) ?>" alt="Symfony!" />
1009
1009
1010
+ .. versionadded :: 2.5
1011
+ Versioned URLs for assets were introduced in Symfony 2.5.
1012
+
1013
+ If you need versioned URLs for assets, you can set the fourth argument (or the
1014
+ ``version `` argument) to the desired version:
1015
+
1016
+ .. configuration-block ::
1017
+
1018
+ .. code-block :: html+jinja
1019
+
1020
+ <img src="{{ asset('images/logo.png', version=3.0) }}" alt="Symfony!" />
1021
+
1022
+ .. code-block :: html+php
1023
+
1024
+ <img src="<?php echo $view['assets']->getUrl('images/logo.png', null, false, '3.0') ?>" alt="Symfony!" />
1025
+
1026
+ If you dont give a version or pass ``null ``, the default package version will
1027
+ be used. If you pass ``false ``, versioned URL will be deactivated.
1028
+
1010
1029
.. index ::
1011
1030
single: Templating; Including stylesheets and JavaScripts
1012
1031
single: Stylesheets; Including stylesheets
Original file line number Diff line number Diff line change @@ -80,6 +80,18 @@ is used in :phpfunction:`sprintf`. The first argument is the path and the
80
80
second is the version. For instance, ``%s?v=%s `` will be rendered as
81
81
``/images/logo.png?v=328rad75 ``.
82
82
83
+ .. versionadded :: 2.5
84
+ On-demand versioned URLs for assets were introduced in Symfony 2.5.
85
+
86
+ You can also generate a versioned URL using the fourth argument of the helper:
87
+
88
+ .. code-block :: html+php
89
+
90
+ <img src="<?php echo $view['assets']->getUrl('images/logo.png', null, false, '3.0') ?>">
91
+ <!-- renders as:
92
+ <img src="/images/logo.png?v=3.0">
93
+ -->
94
+
83
95
Multiple Packages
84
96
-----------------
85
97
You can’t perform that action at this time.
0 commit comments