Answers.Body: <p>This would be a good task for a plugin.</p>
  
  <p>You'd essentially need to build the plugin to do a couple of things:</p>
  
  <p>(1) Use PHP in a <strong><a href="http://buildwithcraft.com/docs/plugins/services">service</a></strong> to list the contents of a directory. Once you have that list, you'd then need to...</p>
  
  <p>(2) Deliver that information to the front end via a custom <strong><a href="http://buildwithcraft.com/docs/plugins/field-types">field type</a></strong>. You can then use your new custom field type wherever you'd like.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-16T07:45:03.443Z
Answers.Text: Combine
  
  https://github.com/lukeholder/craft-dir
  
  to populate this plugin with the template names:
  
  https://github.com/lewisjenkins/craft-lj-dynamicfields/
Answers.UserDisplayName: Luke Holder
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-16T07:47:02.630Z
Answers.Text: I would love to see a plugin that does a much more sophisticated template picker in the future - maybe even with thumbnails for the different templates.
Answers.UserDisplayName: Luke Holder
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-15T06:25:38.097Z
Answers.LastActivityDate: 2014-06-15T06:31:51.433Z
Answers.LastEditDate: 2014-06-15T06:31:51.433Z
Answers.UserDisplayName: Lindsey D
Answers.Body: <p>try using this:</p>
  
  <p><a href="https://github.com/lukeholder/dir" rel="nofollow">https://github.com/lukeholder/dir</a></p>
  
  <p>to populate this plugin with the template names:</p>
  
  <p><a href="https://github.com/lewisjenkins/craft-lj-dynamicfields/" rel="nofollow">https://github.com/lewisjenkins/craft-lj-dynamicfields/</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-18T02:54:17.837Z
Answers.Text: Works great Luke. {% for template in craft.dir.templates('some/folder') %}
    { "value":"{{ template }}" , "label":"{{ template }}" }{% if not loop.last %},{% endif %}
  {% endfor %}
Answers.UserDisplayName: Steve Adams
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-19T03:57:19.233Z
Answers.Text: thanks @pixelJitsu i still think there is a good market for a template selector field plugin, but this is a good stopgap. :)
Answers.UserDisplayName: Luke Holder
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-18T02:24:15.943Z
Answers.LastActivityDate: 2014-06-18T02:24:15.943Z
Answers.UserDisplayName: Luke Holder
Body: <p>When I have a folder setup for template partials, is there a way I could automatically populate a drop-down with the list of templates in that folder?</p>
  
  <p>This would be useful in the case where I have a complex matrix field set, and would like to select a partial to render or include along with the block's content. </p>
  
  <p>If the drop-down were automatically populated, it would eliminate a lot of time setting up the drop-downs in the backend, and would make it much easier to deploy new feature sets across many Craft based sites as they are developed or improved.</p>
  
Tags: <templating><matrix><drop-down><field>
Title: Is there a way to populate a drop-down with the templates files in a folder?
ThreadText: # Is there a way to populate a drop-down with the templates files in a folder?
  
  (Asked by: username_0 on 2014-06-15)
  
  When I have a folder setup for template partials, is there a way I could automatically populate a drop-down with the list of templates in that folder?
  
  This would be useful in the case where I have a complex matrix field set, and would like to select a partial to render or include along with the block's content.
  
  If the drop-down were automatically populated, it would eliminate a lot of time setting up the drop-downs in the backend, and would make it much easier to deploy new feature sets across many Craft based sites as they are developed or improved.
  
  **Tags:** templating, matrix, drop-down, field
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2014-06-18. Score: 5 | Accepted answer
  
  try using this:
  
  <https://github.com/username_2/dir>
  
  to populate this plugin with the template names:
  
  <https://github.com/lewisjenkins/craft-lj-dynamicfields/>
  
  > **Comments:**
  > **username_0**: Works great username_2. {% for template in craft.dir.templates('some/folder') %}   { "value":"{{ template }}" , "label":"{{ template }}" }{% if not loop.last %},{% endif %} {% endfor %}  
  > **username_2**: thanks @pixelJitsu i still think there is a good market for a template selector field plugin, but this is a good stopgap. :)  
  
  ---
  
  ### Answer by username_1 on 2014-06-15. Score: 6
  
  This would be a good task for a plugin.
  
  You'd essentially need to build the plugin to do a couple of things:
  
  (1) Use PHP in a **[service](http://buildwithcraft.com/docs/plugins/services)** to list the contents of a directory. Once you have that list, you'd then need to...
  
  (2) Deliver that information to the front end via a custom **[field type](http://buildwithcraft.com/docs/plugins/field-types)**. You can then use your new custom field type wherever you'd like.
  
  > **Comments:**
  > **username_2**: Combine  https://github.com/username_2/craft-dir  to populate this plugin with the template names:  https://github.com/lewisjenkins/craft-lj-dynamicfields/  
  > **username_2**: I would love to see a plugin that does a much more sophisticated template picker in the future - maybe even with thumbnails for the different templates.  
  
  ---
  
  