Answers.Body: <p>I'm a beginner myself but have used assets plenty of times. It should be something like this:</p>
  
  <pre><code>{% set entry = craft.entries.section('gallery').first() %}
  {% set assets = entry.gallery %}
  {% if assets | length %}
      {% for asset in assets %}
          &lt;img src="{{ asset.getUrl('imgTransform') }}" width="{{ asset.getWidth('imgTransform') }}" height="{{ asset.getHeight('imgTransform') }}" alt="{{ entry.title }}"&gt;
      {% endfor %}
  {% endif %}
  </code></pre>
  
  <p>I use a set entry instead of a for loop because I'm assuming you only have one entry (one gallery). Maybe use a single section instead of a channel than? If you have multiple galleries, a channel is perfect, than you can use a for loop.</p>
  
  <p>The imgTransform can be set in your assets page in the Control Panel. More info: <a href="http://buildwithcraft.com/docs/image-transforms" rel="nofollow">http://buildwithcraft.com/docs/image-transforms</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-16T11:57:54.087Z
Answers.Text: So where do you put this code? In a new template? I am really new to this. A one-gallery solution is perfectly fine. Could you please give me detailed instruction for that? thanks
Answers.UserDisplayName: Csaba Dobo
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-16T12:04:26.970Z
Answers.Text: Yes. Just a HTML file that you reference to in your channel settings. For example gallery.html. You can put the name of your template into the bottom input field of your channel settings in the CP. Than when you go to yoursite.com/gallery it'll load the template and output your gallery. Take a look at https://github.com/pixelandtonic/HappyLager/tree/master/final/web for some examples.
Answers.UserDisplayName: Tom De Smet
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-16T13:33:42.097Z
Answers.Text: @TomDeSmet You had an extra endfor at the end that I removed. I hope you don't mind the edit. ;)
Answers.UserDisplayName: Douglas McDonald
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-16T13:34:56.130Z
Answers.Text: Certainly not :) Will double check my code next time. Thanks!
Answers.UserDisplayName: Tom De Smet
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-16T11:31:36.727Z
Answers.LastActivityDate: 2014-11-16T13:29:53.583Z
Answers.LastEditDate: 2014-11-16T13:29:53.583Z
Answers.UserDisplayName: Tom De Smet
Answers.Body: <p>I thought I might fill in a few extra details to support <a href="https://craftcms.stackexchange.com/a/4746/784">Tom De Smet's excellent answer</a>.</p>
  
  <p>If you only need one gallery then as Tom suggested you can change the section type from a <code>channel</code> to a <code>single</code> in the section's settings. Where you choose to display the gallery is completely up to you. It can either be displayed in it's own template (the one you define in the section's settings), or just as easily in any other template or page on your site.</p>
  
  <p>If displayed in its own template, and if using a <code>single</code> then the template might be something like <code>gallery.html</code> or <code>gallery/index.html</code>, either of which could be accessed by the url <code>mysite.com/gallery</code>. If using a channel (with one or more gallery entries) then a common convention would be to use <code>gallery/_entry.html</code>, which could be accessed using the url <code>mysite.com/gallery/my-gallery-slug</code>.</p>
  
  <p>Whenever a request is made to either of these uri patterns craft will automatically provide an <code>entry</code> variable to the template populated with an <code>EntryModel</code> for the gallery entry — in which case you do not need to retrieve the entry using <code>{% set entry = craft.entries.section('gallery').first() %}</code> as <code>entry</code> will already be pre-defined.</p>
  
  <p>If on the other hand you want to display the gallery somewhere else on your site (in some other template) then you will first need to retrieve the gallery entry using <code>{% set entry = craft.entries.section('gallery').first() %}</code> or <code>{% set entry = craft.entries.section('gallery').slug('my-gallery-slug') %}</code>.</p>
  
  <p>Also, keep in mind that using a <code>structure</code> with multiple <code>EntryTypes</code> defined (one of which could be 'gallery') would be another way to essentially house various 'singles' together with the advantage that you can then generate heirarchical site navigation from the structure.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-16T19:06:02.533Z
Answers.Text: Hello, many thanks for your answers. Let me ask this too: is the above code for single age type or for channels or for both?
Answers.UserDisplayName: Csaba Dobo
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-16T19:19:58.710Z
Answers.Text: Most of the code on both answers will work for singles, channels, or structures. The difference is that in a channel or structure (where there can be more than one) you need to either loop through the entries or provide some additional identifier (i.e. id(), slug(), first(), etc.) to retrieve the one you are looking for. And if you're using the defined template path then `entry` will already be defined and you can just access it directly (i.e. `{{ entry.title }}` ).
Answers.UserDisplayName: Douglas McDonald
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-16T19:59:44.647Z
Answers.Text: I feel sorry for my beginner questions. I converted this setup to a single, inserted the code above to a gallery.html file but get this: "Internal Server Error
  
  Craft\EntryModel and its behaviours do not have a method or closure named "gallery"." In under Entries/singles/gallery I only have Title input field. Maybe that is why it is not working. I would post a screenshot but can not do that here.
Answers.UserDisplayName: Csaba Dobo
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-16T20:30:37.057Z
Answers.Text: Ah yes. You need to add your field 'gallery' to the fieldLayout of your single, also called gallery. You can do this in settings>sections>gallery>entry type>gallery, then drag the field to your sections field layout.
Answers.UserDisplayName: Douglas McDonald
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-16T20:53:45.787Z
Answers.Text: It is getting better. Now I managed to add the assets to the single net to title. But now what I get is: "Internal Server Error
  The transform “imgTransform” cannot be found!" I had previously set up image transfer in the control panel, but no effect so I deleted it. Do I have to write something in the code in the gallery.html template? hm??
Answers.UserDisplayName: Csaba Dobo
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-16T21:05:48.627Z
Answers.Text: Never mind. My image transform had a different name. Thanks for al the help. I think I will have more. Maybe one for now: are there any case studies or step-by-step guides available? Perhaps with screenshots? How do you get started quickly?
Answers.UserDisplayName: Csaba Dobo
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-17T00:14:03.790Z
Answers.Text: @CsabaDobo Check out https://mijingo.com/products/screencasts/craft-cms-tutorial/
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-16T15:07:56.497Z
Answers.LastActivityDate: 2014-11-16T16:49:32.767Z
Answers.LastEditDate: 2017-04-13T12:51:00.303Z
Answers.UserDisplayName: Douglas McDonald
Body: <p>Just installed the cms last night. I am looking for a step-by-step instruction on how to create a gallery and display it.</p>
  
  <p>So far I have created the:
  - channel called: Gallery
  - section called: Gallery
  - entry type: Gallery
  - the assets field named: gallery
  - added 4 images
  - created a new entry called: Gallery (only the Title is visible so far) and this is where I got stuck. </p>
  
  <p>Any help would be greatly appreciated</p>
  
Tags: <gallery>
Title: How to build a simple gallery
ThreadText: # How to build a simple gallery
  
  (Asked by: username_0 on 2014-11-16)
  
  Just installed the cms last night. I am looking for a step-by-step instruction on how to create a gallery and display it.
  
  So far I have created the:
  - channel called: Gallery
  - section called: Gallery
  - entry type: Gallery
  - the assets field named: gallery
  - added 4 images
  - created a new entry called: Gallery (only the Title is visible so far) and this is where I got stuck.
  
  Any help would be greatly appreciated
  
  **Tags:** gallery
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2014-11-16. Score: 3
  
  I'm a beginner myself but have used assets plenty of times. It should be something like this:
  
  ```
  {% set entry = craft.entries.section('gallery').first() %}
  {% set assets = entry.gallery %}
  {% if assets | length %}
      {% for asset in assets %}
          <img src="{{ asset.getUrl('imgTransform') }}" width="{{ asset.getWidth('imgTransform') }}" height="{{ asset.getHeight('imgTransform') }}" alt="{{ entry.title }}">
      {% endfor %}
  {% endif %}
  
  ```
  
  I use a set entry instead of a for loop because I'm assuming you only have one entry (one gallery). Maybe use a single section instead of a channel than? If you have multiple galleries, a channel is perfect, than you can use a for loop.
  
  The imgTransform can be set in your assets page in the Control Panel. More info: <http://buildwithcraft.com/docs/image-transforms>
  
  > **Comments:**
  > **username_0**: So where do you put this code? In a new template? I am really new to this. A one-gallery solution is perfectly fine. Could you please give me detailed instruction for that? thanks  
  > **username_1**: Yes. Just a HTML file that you reference to in your channel settings. For example gallery.html. You can put the name of your template into the bottom input field of your channel settings in the CP. Than when you go to yoursite.com/gallery it'll load the template and output your gallery. Take a look at https://github.com/pixelandtonic/HappyLager/tree/master/final/web for some examples.  
  > **username_2**: @username_1 You had an extra endfor at the end that I removed. I hope you don't mind the edit. ;)  
  > **username_1**: Certainly not :) Will double check my code next time. Thanks!  
  
  ---
  
  ### Answer by username_2 on 2014-11-16. Score: 1
  
  I thought I might fill in a few extra details to support [username_1's excellent answer](https://craftcms.stackexchange.com/a/4746/784).
  
  If you only need one gallery then as Tom suggested you can change the section type from a `channel` to a `single` in the section's settings. Where you choose to display the gallery is completely up to you. It can either be displayed in it's own template (the one you define in the section's settings), or just as easily in any other template or page on your site.
  
  If displayed in its own template, and if using a `single` then the template might be something like `gallery.html` or `gallery/index.html`, either of which could be accessed by the url `mysite.com/gallery`. If using a channel (with one or more gallery entries) then a common convention would be to use `gallery/_entry.html`, which could be accessed using the url `mysite.com/gallery/my-gallery-slug`.
  
  Whenever a request is made to either of these uri patterns craft will automatically provide an `entry` variable to the template populated with an `EntryModel` for the gallery entry — in which case you do not need to retrieve the entry using `{% set entry = craft.entries.section('gallery').first() %}` as `entry` will already be pre-defined.
  
  If on the other hand you want to display the gallery somewhere else on your site (in some other template) then you will first need to retrieve the gallery entry using `{% set entry = craft.entries.section('gallery').first() %}` or `{% set entry = craft.entries.section('gallery').slug('my-gallery-slug') %}`.
  
  Also, keep in mind that using a `structure` with multiple `EntryTypes` defined (one of which could be 'gallery') would be another way to essentially house various 'singles' together with the advantage that you can then generate heirarchical site navigation from the structure.
  
  > **Comments:**
  > **username_0**: Hello, many thanks for your answers. Let me ask this too: is the above code for single age type or for channels or for both?  
  > **username_2**: Most of the code on both answers will work for singles, channels, or structures. The difference is that in a channel or structure (where there can be more than one) you need to either loop through the entries or provide some additional identifier (i.e. id(), slug(), first(), etc.) to retrieve the one you are looking for. And if you're using the defined template path then `entry` will already be defined and you can just access it directly (i.e. `{{ entry.title }}` ).  
  > **username_0**: I feel sorry for my beginner questions. I converted this setup to a single, inserted the code above to a gallery.html file but get this: "Internal Server Error  Craft\EntryModel and its behaviours do not have a method or closure named "gallery"." In under Entries/singles/gallery I only have Title input field. Maybe that is why it is not working. I would post a screenshot but can not do that here.  
  > **username_2**: Ah yes. You need to add your field 'gallery' to the fieldLayout of your single, also called gallery. You can do this in settings>sections>gallery>entry type>gallery, then drag the field to your sections field layout.  
  > **username_0**: It is getting better. Now I managed to add the assets to the single net to title. But now what I get is: "Internal Server Error The transform “imgTransform” cannot be found!" I had previously set up image transfer in the control panel, but no effect so I deleted it. Do I have to write something in the code in the gallery.html template? hm??  
  > **username_0**: Never mind. My image transform had a different name. Thanks for al the help. I think I will have more. Maybe one for now: are there any case studies or step-by-step guides available? Perhaps with screenshots? How do you get started quickly?  
  > **username_3**: @username_0 Check out https://mijingo.com/products/screencasts/craft-cms-tutorial/  
  
  ---
  
  