Skip to main content
added 54 characters in body
Source Link
Victor
  • 8.4k
  • 1
  • 36
  • 61

I'm trying to do this:

{% for image in entry.illustration %}
    {% if image | length %}
        <a href="{{ entry.url }}" class="flag__img">
            <img src="{{ image.getUrl }}" alt="{{ entry.altText }}" class="profile__image"><class="profile__image">
        </a>
    {% else %}  
        <p>No image.</p>        
    {% endif %}
{% endfor %}

Without any luck. What would be a good way of telling craft to do something else if entry.illustration does not have an image defined?

I'm trying to do this:

{% for image in entry.illustration %}
{% if image | length %}
<a href="{{ entry.url }}" class="flag__img">
<img src="{{ image.getUrl }}" alt="{{ entry.altText }}" class="profile__image"></a>
{% else %}  
<p>No image.</p>        
{% endif %}
{% endfor %}

Without any luck. What would be a good way of telling craft to do something else if entry.illustration does not have an image defined?

I'm trying to do this:

{% for image in entry.illustration %}
    {% if image | length %}
        <a href="{{ entry.url }}" class="flag__img">
            <img src="{{ image.getUrl }}" alt="{{ entry.altText }}" class="profile__image">
        </a>
    {% else %}  
        <p>No image.</p>        
    {% endif %}
{% endfor %}

Without any luck. What would be a good way of telling craft to do something else if entry.illustration does not have an image defined?

Source Link
osh
  • 615
  • 2
  • 7
  • 16

Showing a generic image when no image is chosen

I'm trying to do this:

{% for image in entry.illustration %}
{% if image | length %}
<a href="{{ entry.url }}" class="flag__img">
<img src="{{ image.getUrl }}" alt="{{ entry.altText }}" class="profile__image"></a>
{% else %}  
<p>No image.</p>        
{% endif %}
{% endfor %}

Without any luck. What would be a good way of telling craft to do something else if entry.illustration does not have an image defined?