Code: Select all
<?php echo str_replace(array('-300x300.jpg', '-'), array('', ' '), basename($thumb)); ?>
How to convert this code to twig, i would like to use this in opencart 3?
I tried some online convertors, but without success.
Code: Select all
<?php echo str_replace(array('-300x300.jpg', '-'), array('', ' '), basename($thumb)); ?>
Code: Select all
{{ basename_image }}
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Code: Select all
{% set temp_thumb_array = thumb|split('/') %}
{% set temp_thumb = temp_thumb_array|last|replace({'-300x300.jpg': "", "-" : " "}) %}
{{ temp_thumb }}</li>
Maybe, but it should be done in the controller and it should use a RegEx so you don't have to hard code the 300 image sizes.
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces
“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.
Users browsing this forum: Majestic-12 [Bot] and 22 guests