Hi all - I have a product page with an image field in the blueprint and I’m using the following code in the template file to show the image, which is working fine:
<?php if($image = $product->images()->sortBy('sort', 'asc')->first()): $thumb = $image->crop(600, 400); ?>
<img src="<?= $thumb->url() ?>" class="responsive" />
<?php endif ?>
My issue is that i have a page called ‘what we do’ which is hyphenated in the content folder / url (what-we-do) and I can’t use dashes in the above code (image = $what-we-do->images) so how do I get a dash in the variable? I’ve asked a similar question before and some people said I could name the variable anything I wanted, but how would I do this as I’m assuming the variable in this case is the name of the page in question?
Thanks!