Just declare in your PHP script something like:This template variable you can set up for usage within JS with the following structure within the HTML file that uses the JS script:Now you can use this path e.g. for putting an image into a HTML tag with an id within the JS script:The last code segment would be jQuery which is preferred over vanilla JS by the validators.
Code:
$this->template->assign_vars(['HIFIKABIN_APRILFOOLS_PNG_PATH'=> $this->phpbb_root . 'ext/hifikabin/aprilfools/styles/prosilver/themes/images/',]);
Code:
<script>let imageSprite = "{{ HIFIKABIN_APRILFOOLS_PNG_PATH|e('js') }}";</script>
Code:
$("#my_div_id").html(imageSprite + "fly-sprite.png");
Statistics: Posted by Mike-on-Tour — Wed Feb 14, 2024 10:33 am