Answers.Body: <p>It looks like you are trying to access a <code>news</code> variable that probably doesn't exist.</p>
  
  <pre><code>{% for entry in craft.entries.section('news').relatedTo(category) %} 
  
      {# Your image field will be found on your `entry` variable (not a `news` variable) #}
      {% for image in entry.newsimage %}
  
          {# One you are looping through your image field, 
             you can access the image properties via the `image` 
             variable you defined in your loop #}
          &lt;a href="{{ image.getUrl() }}"&gt;
            &lt;img alt="{{ image.title }}" src="{{ image.getUrl() }}" /&gt;
          &lt;/a&gt;
  
      {% endfor %}
  
  {% endfor %}
  </code></pre>
  
  <p>If you only have a single news image, you can grab that image directly using the <code>first()</code> method, instead of looping through your image field:</p>
  
  <pre><code>{% for entry in craft.entries.section('news').relatedTo(category) %} 
  
      {% set image = entry.newsimage.first() %}
  
      {% if image %}
          &lt;a href="{{ image.getUrl() }}"&gt;
            &lt;img alt="{{ image.title }}" src="{{ image.getUrl() }}" /&gt;
          &lt;/a&gt;
      {% endif %}
  
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-27T03:36:54.883Z
Answers.Text: Thank makes complete sense...
  Thank you so much Ben..
Answers.UserDisplayName: fidel
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-27T02:39:57.267Z
Answers.LastActivityDate: 2016-06-27T02:39:57.267Z
Answers.UserDisplayName: Ben Parizek
Body: <p>I'm running into an issue here, hopefully someone can shed some light. 
  I'm in a news category template, </p>
  
  <pre><code>{% for entry in craft.entries.section('news').relatedTo(category) %} 
    {% for image in news.newsimage %}
      &lt;a href="{{ news.url }}"&gt;&lt;img alt="{{ news.title }}" src="{{ news.url }}" /&gt;&lt;/a&gt;
    {% endfor %}
    {{ entry.title }}
  {% endfor %}
  </code></pre>
  
  <p>My entry.title, date, etc. all output correctly, I can't figure out how to output the image asset associated with newsimage. </p>
  
Tags: <assets><category>
Title: Image entry in a category template
ThreadText: # Image entry in a category template
  
  (Asked by: username_0 on 2016-06-26)
  
  I'm running into an issue here, hopefully someone can shed some light.
  I'm in a news category template,
  
  ```
  {% for entry in craft.entries.section('news').relatedTo(category) %} 
    {% for image in news.newsimage %}
      <a href="{{ news.url }}"><img alt="{{ news.title }}" src="{{ news.url }}" /></a>
    {% endfor %}
    {{ entry.title }}
  {% endfor %}
  
  ```
  
  My entry.title, date, etc. all output correctly, I can't figure out how to output the image asset associated with newsimage.
  
  **Tags:** assets, category
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-06-27. Score: 3
  
  It looks like you are trying to access a `news` variable that probably doesn't exist.
  
  ```
  {% for entry in craft.entries.section('news').relatedTo(category) %} 
  
      {# Your image field will be found on your `entry` variable (not a `news` variable) #}
      {% for image in entry.newsimage %}
  
          {# One you are looping through your image field, 
             you can access the image properties via the `image` 
             variable you defined in your loop #}
          <a href="{{ image.getUrl() }}">
            <img alt="{{ image.title }}" src="{{ image.getUrl() }}" />
          </a>
  
      {% endfor %}
  
  {% endfor %}
  
  ```
  
  If you only have a single news image, you can grab that image directly using the `first()` method, instead of looping through your image field:
  
  ```
  {% for entry in craft.entries.section('news').relatedTo(category) %} 
  
      {% set image = entry.newsimage.first() %}
  
      {% if image %}
          <a href="{{ image.getUrl() }}">
            <img alt="{{ image.title }}" src="{{ image.getUrl() }}" />
          </a>
      {% endif %}
  
  {% endfor %}
  
  ```
  
  > **Comments:**
  > **username_0**: Thank makes complete sense... Thank you so much Ben..  
  
  ---
  
  