Answers.Body: <p>Image fields are an array, because you can have multiple images within that field. Usually you would loop through the array to output your images:</p>
  
  <pre><code>{% if Logo.logo | length %}
      {% for image in Logo.logo %}
          {{ image.url }}
      {% endfor %}
  {% endif %}
  </code></pre>
  
  <p>Or, if you only have a single image in the array, you can just do this:</p>
  
  <pre><code>{% set image = Logo.logo.first() %}
  
  {% if image %}
      {{ image.url }}
  {% endif %}
  </code></pre>
  
  <p>More info on Asset templating <a href="http://buildwithcraft.com/docs/assets-fields#templating" rel="nofollow">here</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-24T02:26:06.910Z
Answers.Text: Thanks but I already tried that as well and it wasn't working. It's always empty so it doesn't get past the if statement.
Answers.UserDisplayName: Bowenac
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-24T05:21:19.543Z
Answers.Text: Make sure you are using the globalSet handle and not the title. I would guess that it is all lowercase. `{{ logo.logo.first.url }}`
Answers.UserDisplayName: Douglas McDonald
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-24T13:39:16.557Z
Answers.Text: Thank you that was it, Looking back I read the docs wrong and thought I was supposed to use the Global Set Name.Handle but now I know its globalSetHandle.FieldName thanks for help much appreciated. Really liking craft so far.
Answers.UserDisplayName: Bowenac
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-23T22:03:41.390Z
Answers.LastActivityDate: 2015-04-23T22:10:26.510Z
Answers.LastEditDate: 2015-04-23T22:10:26.510Z
Answers.UserDisplayName: Lewis Jenkins
Body: <p>Just starting to play with Craft going to be a learning curve coming from wp and processwire etc.</p>
  
  <p>I created a custom Global Set and called it Logo which I assumed I could use in the _layout.html template to show a logo in the header and make it easy to change etc.</p>
  
  <p>I called the set Logo and it has a handle of logo. This created the Globals option in the top nav. Here I was able to upload a logo from my assets etc.</p>
  
  <p>Now in the _layout.html template I am trying to access this image by using the following but nothing shows up.</p>
  
  <pre><code>&lt;img src="{{ Logo.logo }}"&gt;
  </code></pre>
  
  <p>Based on the docs it says:
  You can access your Global Sets from any template via their handles. For example, if you have a Global Set with the handle “companyInfo”, and it has a field with the handle “yearEstablished”, you can access that field anywhere using this code:</p>
  
  <p>{{ companyInfo.yearEstablished }}</p>
  
  <p>I also tried</p>
  
  <pre><code>&lt;img src="{{ Logo.logo.url() }}"&gt;
  </code></pre>
  
  <p>What am I doing wrong am I going about this the wrong way?</p>
  
Tags: <globals>
Title: Accessing Global Set Variable
ThreadText: # Accessing Global Set Variable
  
  (Asked by: username_0 on 2015-04-23)
  
  Just starting to play with Craft going to be a learning curve coming from wp and processwire etc.
  
  I created a custom Global Set and called it Logo which I assumed I could use in the \_layout.html template to show a logo in the header and make it easy to change etc.
  
  I called the set Logo and it has a handle of logo. This created the Globals option in the top nav. Here I was able to upload a logo from my assets etc.
  
  Now in the \_layout.html template I am trying to access this image by using the following but nothing shows up.
  
  ```
  <img src="{{ Logo.logo }}">
  
  ```
  
  Based on the docs it says:
  You can access your Global Sets from any template via their handles. For example, if you have a Global Set with the handle “companyInfo”, and it has a field with the handle “yearEstablished”, you can access that field anywhere using this code:
  
  {{ companyInfo.yearEstablished }}
  
  I also tried
  
  ```
  <img src="{{ Logo.logo.url() }}">
  
  ```
  
  What am I doing wrong am I going about this the wrong way?
  
  **Tags:** globals
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-04-23. Score: 3 | Accepted answer
  
  Image fields are an array, because you can have multiple images within that field. Usually you would loop through the array to output your images:
  
  ```
  {% if Logo.logo | length %}
      {% for image in Logo.logo %}
          {{ image.url }}
      {% endfor %}
  {% endif %}
  
  ```
  
  Or, if you only have a single image in the array, you can just do this:
  
  ```
  {% set image = Logo.logo.first() %}
  
  {% if image %}
      {{ image.url }}
  {% endif %}
  
  ```
  
  More info on Asset templating [here](http://buildwithcraft.com/docs/assets-fields#templating)
  
  > **Comments:**
  > **username_0**: Thanks but I already tried that as well and it wasn't working. It's always empty so it doesn't get past the if statement.  
  > **username_2**: Make sure you are using the globalSet handle and not the title. I would guess that it is all lowercase. `{{ logo.logo.first.url }}`  
  > **username_0**: Thank you that was it, Looking back I read the docs wrong and thought I was supposed to use the Global Set Name.Handle but now I know its globalSetHandle.FieldName thanks for help much appreciated. Really liking craft so far.  
  
  ---
  
  