sebastianr Posted November 29, 2022 Posted November 29, 2022 My code: <div class='ipsPageHeader ipsBox ipsResponsive_pull ipsPadding ipsClearfix' style='background-image: url('{file="$record->_record_image_thumb" extension="cms_Records"}')'> Result: <div class="ipsPageHeader ipsBox ipsResponsive_pull ipsPadding ipsClearfix" style="background-image: url(" https:=""xxx.com="" uploads="" monthly_2022_11="" connor-williams-iir32bprihe-unsplash.thumb.jpg.f54c7b887d3ac0e316547fafa1acd564.jpg="" ')'=""> How to escape the apostrophe to get correct url('image.jpg')?
opentype Posted November 29, 2022 Posted November 29, 2022 I think it should be enough to correct the nesting. You start with style=', but then you end that block with another ' in the '{file. Use double quotes there instead to nest the quotes correctly. When two types of quotes aren’t enough, there would also be the option \' But again, it should not be necessary in your example. And correct the “syle” to “style”. Daniel F 1
Stuart Silvester Posted November 29, 2022 Posted November 29, 2022 You can also use the background image template plugin for this. style='{backgroundimage="\IPS\File::get( 'cms_Records', $record->_record_image_thumb )->url"}'
Recommended Posts