Hello,
I was wondering if someone would be able to help me. (my site is not online)
Basic rundown:
There are two different sections of the website which hold the same information. They’re basically a card with an image and title. One of the sections displays a the card with a “default no image”(blank image with logo) when the user hasn’t uploaded an image. The other does not show the “default no image” if the user hasn’t uploaded an image.
The goal:
I’m basically trying to have the second card of the website display the “default no image” like the first card.
This is the first card that has a working “default no image”
<div class="hello-class">
<a href="{{ link }}">
{% if item.imageId != 0 -%}
{# date from DB -#}
{% set image = item.mainImage ?:item.image %}
<img src="{{ asset(imagePath(image), 'domain_images') | imagine_filter('small') }}"
alt="{{ title }}" class="media-object">
{% elseif item.thumbnail is defined and item.thumbnail is not empty -%}
{# data from elasticsearch -#}
<img src="{{ asset(item.thumbnail, 'domain_images') | imagine_filter('small') }}" alt="{{ title }}"
class="media-object">
{% else -%}
{{ utility_getNoImage(title) }}
{% endif -%}
</a>
</div>
This is the second card that does not display the “default no image”
<div class="hello-class">
{% if flags b-and 2 -%}
{% if itemLevelInfo.hasDetail -%}
<a href="{{ detailURL }}">{{ Utility.image( data.thumbnail, data.title ) }}</a>
{% else -%}
{{ Utility.image( data.thumbnail, data.title ) }}
{% endif -%}
{% endif -%}
</div>
I am really new when it comes to PHP, but i tried adding in the {{ utility_getNoImage(title) }} to the second card to no avail. Or even using the code from the first card on the second card, but that also didn’t’ work. I understand this isn’t the full php code, but i would of thought re-using the shorthand snippets would work. (I’ve re-used some other snippets that seem to work)
Funny, but whilst typing this i realized i could hack a work around by adding a css class to the card which will hold a color/image as a background and not worry about it. However It’s worth asking for help, learning something and it would be better having it all connected and automated.
Appreciate the help.