XF 2.1 How to add query string to add-on images

mjda

Well-known member
My add-on has an image that could be changed each time I update the add-on. In fact, sometimes the only update to the add-on could be the image being changed. Is there a way I can force the image to use a query string, automatically, that changes every time I update the add-on?

Here's where the image is called, then I have other css for each class I use that sets the background-position:

CSS:
background: url('/styles/default/scc/scclt-favteams.png') no-repeat;

I'd like it to be something like this, but without me having to manually change it every time:

CSS:
background: url('/styles/default/scc/scclt-favteams.png?123456789') no-repeat;
 
You could add ?{{ $xf.style.getLastModified() ?: $xf.time }} to the URL. This will update the query string each time the style is modified (which should happen automatically when an add-on is installed/upgraded).
 
You could add ?{{ $xf.style.getLastModified() ?: $xf.time }} to the URL. This will update the query string each time the style is modified (which should happen automatically when an add-on is installed/upgraded).

Yep! This worked perfectly. Thanks!
 
Back
Top Bottom