Answers.Body: <p>You’re close. When you do this:</p>
  
  
  
  <pre class="lang-twig prettyprint-override"><code>{% for image in entry.logos %}
      ...
  {% endfor %}
  </code></pre>
  
  <p>The code within the for-loop will be repeated for each asset that was assigned to your <code>entry.logos</code> field. Each time, the <code>image</code> variable will be assigned the current asset.</p>
  
  <p>So, if you want to access a field that is <em>on the asset</em> (e.g. your <code>logoUrl</code> field), you would access that via <code>image.logoUrl</code> rather than <code>logos.logoUrl</code>. (You don’t actually have a variable named <code>logos</code>, so if you have <a href="http://buildwithcraft.com/help/dev-mode" rel="nofollow">Dev Mode</a> enabled, that template would be giving you an error about that.)</p>
  
  <pre class="lang-twig prettyprint-override"><code>{% set logo = { width: 175, height: 120, mode: 'fit' } %}
  
  {% for image in entry.logos %}
      &lt;li&gt;&lt;a href="{{ image.logoURL }}"&gt;&lt;img src="{{ image.getUrl(logo) }}" height="{{ image.getHeight(logo) }}" width="{{ image.getWidth(logo) }}" alt="{{ image.title }}"&gt;&lt;/a&gt;&lt;/li&gt;
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-09T17:19:46.537Z
Answers.Text: Thank you, Brandon! That worked. I thought I had tried that variation but alas. We're on our 7th Craft license and loving it.
Answers.UserDisplayName: glider
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-09T17:24:30.300Z
Answers.Text: @David Glad to hear that! :)
Answers.UserDisplayName: Brandon Kelly
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-09T17:00:02.007Z
Answers.LastActivityDate: 2014-10-09T17:00:02.007Z
Answers.UserDisplayName: Brandon Kelly
Body: <p>I want to setup a custom field to assign a URL for an image.  On the front end I want to output the image and then wrap it in a URL. I've setup a field called 'logoURL' but not sure how to access that data.  What I have isn't working and I've tried several variations.</p>
  
  <pre><code>{% set logo = { width: 175, height: 120, mode: 'fit' } %}
  
  {% for image in entry.logos %}
      &lt;li&gt;
          &lt;a href="{{ logos.logoURL }}"&gt;&lt;img src="{{ image.getUrl(logo) }}" height="{{ image.getHeight(logo) }}" width="{{ image.getWidth(logo) }}" alt="{{ image.title }}"&gt;&lt;/a&gt;          
      &lt;/li&gt;
  {% endfor %}
  </code></pre>
  
Tags: <assets>
Title: How do I access a custom Asset field within an Assets field?
ThreadText: # How do I access a custom Asset field within an Assets field?
  
  (Asked by: username_0 on 2014-10-09)
  
  I want to setup a custom field to assign a URL for an image. On the front end I want to output the image and then wrap it in a URL. I've setup a field called 'logoURL' but not sure how to access that data. What I have isn't working and I've tried several variations.
  
  ```
  {% set logo = { width: 175, height: 120, mode: 'fit' } %}
  
  {% for image in entry.logos %}
      <li>
          <a href="{{ logos.logoURL }}"><img src="{{ image.getUrl(logo) }}" height="{{ image.getHeight(logo) }}" width="{{ image.getWidth(logo) }}" alt="{{ image.title }}"></a>          
      </li>
  {% endfor %}
  
  ```
  
  **Tags:** assets
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-10-09. Score: 2
  
  You’re close. When you do this:
  
  ```twig
  {% for image in entry.logos %}
      ...
  {% endfor %}
  
  ```
  
  The code within the for-loop will be repeated for each asset that was assigned to your `entry.logos` field. Each time, the `image` variable will be assigned the current asset.
  
  So, if you want to access a field that is *on the asset* (e.g. your `logoUrl` field), you would access that via `image.logoUrl` rather than `logos.logoUrl`. (You don’t actually have a variable named `logos`, so if you have [Dev Mode](http://buildwithcraft.com/help/dev-mode) enabled, that template would be giving you an error about that.)
  
  ```twig
  {% set logo = { width: 175, height: 120, mode: 'fit' } %}
  
  {% for image in entry.logos %}
      <li><a href="{{ image.logoURL }}"><img src="{{ image.getUrl(logo) }}" height="{{ image.getHeight(logo) }}" width="{{ image.getWidth(logo) }}" alt="{{ image.title }}"></a></li>
  {% endfor %}
  
  ```
  
  > **Comments:**
  > **username_0**: Thank you, username_1! That worked. I thought I had tried that variation but alas. We're on our 7th Craft license and loving it.  
  > **username_1**: @David Glad to hear that! :)  
  
  ---
  
  