Answers.Body: <p>Probably and yes.</p>
  
  <p><strong>Using tags for cities:</strong></p>
  
  <p>If you want to allow users to add any city they want, tags are perfect. If not, you should predefine them, and use categories, dropdowns or multi-selects.</p>
  
  <p>Since you don't know if the user has actually entered a city, you should consider validating it with a custom plugin:</p>
  
  <ul>
  <li>Wait for the <a href="http://buildwithcraft.com/docs/plugins/events-reference#entries-onBeforeSaveEntry" rel="nofollow">entries.onBeforeSaveEntry</a> event</li>
  <li>Check if the entered tag is a city. (You could use the <a href="https://developers.google.com/maps/documentation/geocoding/?hl=de" rel="nofollow">Google Geocoding API</a>)</li>
  </ul>
  
  <p>.</p>
  
  <p><strong>List entries which have a specific tag:</strong></p>
  
  <p>You can use <a href="http://buildwithcraft.com/docs/relations" rel="nofollow">relations</a> to find all entries which have a specific tag:</p>
  
  <pre class="lang-twig prettyprint-override"><code>{% set tag = craft.tags.name('miami') %}
  {% set relatedEntries = craft.entries.section('events').relatedTo(tag) %}
  
  {# Gets all entries which have the 'miami' tag #}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-01T15:34:44.863Z
Answers.LastActivityDate: 2014-07-01T15:34:44.863Z
Answers.UserDisplayName: Victor
Answers.Body: <p>There is an address plugin available, that might be useful for your event locations. It's called <a href="https://github.com/lindseydiloreto/craft-smartmap/wiki" rel="nofollow">craft-smartmap</a> by Lindsey D.</p>
  
  <p>Addresses are auto-completed on input, latitude and longitude are calculated (for maps output etc.) and you have access to the cities names like with any other field type.</p>
  
  <p>I don't know if it's overkill for your goals and you just need the city names. Nevertheless added this here as it might be worth a look.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-03T01:56:12.913Z
Answers.Text: Seconded. Incredible plugin and I believe he has some great features coming down the pipeline for it very soon :)
Answers.UserDisplayName: Seán O'Grady
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-01T16:03:53.053Z
Answers.LastActivityDate: 2014-07-01T16:03:53.053Z
Answers.UserDisplayName: carlcs
Answers.Body: <p>I agree with Victor, but if you're looking to loop through all the cities (regardless of how many you have) and show entries related to them I'd do it like this:</p>
  
  <pre class="lang-twig prettyprint-override"><code>{% set entries = craft.entries.section('events').limit(null) %}
  {% for tag in craft.tags('cities') %}
      &lt;h2&gt;{{ tag }}&lt;/h2&gt;
          {% for entry in entries.relatedTo(tag) %}
              {# entry #}
          {% endfor %}
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-01T15:52:40.050Z
Answers.LastActivityDate: 2014-07-01T15:57:00.743Z
Answers.LastEditDate: 2014-07-01T15:57:00.743Z
Answers.UserDisplayName: Simon Kuran
Body: <p>I would like to have some advise on the following:</p>
  
  <p>I'll be running a site with events. These events (channel entries) will take place in a certain city. I don't want to setup every city as a category, but use tags instead. My questions are:</p>
  
  <ol>
  <li>Is it logical to use tags for cities?</li>
  <li>Can I list all events based on a city (tag) on my template?</li>
  </ol>
  
  <p>Thanks. </p>
  
Tags: <entries><tags>
Title: Should I use tags for cities?
ThreadText: # Should I use tags for cities?
  
  (Asked by: username_0 on 2014-07-01)
  
  I would like to have some advise on the following:
  
  I'll be running a site with events. These events (channel entries) will take place in a certain city. I don't want to setup every city as a category, but use tags instead. My questions are:
  
  1. Is it logical to use tags for cities?
  2. Can I list all events based on a city (tag) on my template?
  
  Thanks.
  
  **Tags:** entries, tags
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2014-07-01. Score: 3
  
  Probably and yes.
  
  **Using tags for cities:**
  
  If you want to allow users to add any city they want, tags are perfect. If not, you should predefine them, and use categories, dropdowns or multi-selects.
  
  Since you don't know if the user has actually entered a city, you should consider validating it with a custom plugin:
  
  * Wait for the [entries.onBeforeSaveEntry](http://buildwithcraft.com/docs/plugins/events-reference#entries-onBeforeSaveEntry) event
  * Check if the entered tag is a city. (You could use the [Google Geocoding API](https://developers.google.com/maps/documentation/geocoding/?hl=de))
  
  .
  
  **List entries which have a specific tag:**
  
  You can use [relations](http://buildwithcraft.com/docs/relations) to find all entries which have a specific tag:
  
  ```twig
  {% set tag = craft.tags.name('miami') %}
  {% set relatedEntries = craft.entries.section('events').relatedTo(tag) %}
  
  {# Gets all entries which have the 'miami' tag #}
  
  ```
  
  
  ---
  
  ### Answer by username_2 on 2014-07-01. Score: 3
  
  There is an address plugin available, that might be useful for your event locations. It's called [craft-smartmap](https://github.com/lindseydiloreto/craft-smartmap/wiki) by Lindsey D.
  
  Addresses are auto-completed on input, latitude and longitude are calculated (for maps output etc.) and you have access to the cities names like with any other field type.
  
  I don't know if it's overkill for your goals and you just need the city names. Nevertheless added this here as it might be worth a look.
  
  > **Comments:**
  > **username_3**: Seconded. Incredible plugin and I believe he has some great features coming down the pipeline for it very soon :)  
  
  ---
  
  ### Answer by username_4 on 2014-07-01. Score: 3
  
  I agree with username_1, but if you're looking to loop through all the cities (regardless of how many you have) and show entries related to them I'd do it like this:
  
  ```twig
  {% set entries = craft.entries.section('events').limit(null) %}
  {% for tag in craft.tags('cities') %}
      <h2>{{ tag }}</h2>
          {% for entry in entries.relatedTo(tag) %}
              {# entry #}
          {% endfor %}
  {% endfor %}
  
  ```
  
  
  ---
  
  