Answers.Body: <p>It looks like you're coming from some other system? When I see "single-whatever" I think of WordPress' specific template structure... which may or may not have any meaning in Craft.</p>
  
  <p>Unlike something like WordPress where there's a very specific structure to how you get information and what template determines how it behaves, Craft is a bit more open-ended (and DIY) in that regard and that can lead to some confusion, especially if you try to setup something like a <a href="http://buildwithcraft.com/docs/templating/search-form" rel="nofollow">search page</a> and then try to use <code>entry</code> as variable (which won't be defined, unless you define it yourself).</p>
  
  <p><strong><em>1. Is there a simple list of the types of pages Craft outputs?</em></strong> </p>
  
  <p>Unlike other content management systems, Craft really doesn't have a concept of "page types". One of the great things about Craft (and probably slightly confusing when you first start) is how you reference content throughout the system in the same, simple way.</p>
  
  <p>You probably know that Craft holds your "page" content in what are called <a href="http://buildwithcraft.com/docs/sections-and-entries" rel="nofollow">Entries</a>. Think of Entries like Pages since they can map to a URL but they don't necessarily have to...</p>
  
  <p><strong><em>2. What are all the variables available...</em></strong></p>
  
  <p>Templates more or less work the same throughout. Craft's <a href="http://buildwithcraft.com/docs/globals" rel="nofollow">Globals</a> are available no matter which template you're in, but Craft really allows you to fetch any piece of content (user, asset, tag, entry, etc.) anywhere you need it.</p>
  
  <p>But what I think you're kind of asking about is when you view an entry or category specifically...</p>
  
  <p>If you setup your sections/categories to have a URL/slug that Craft knows about, Craft automatically will populate the <code>entry</code> or <code>category</code> variable for you so you can access things like title, slug, and any custom fields you might also have on that entry or category. </p>
  
  <p>It's basically a shortcut so you don't have to get it yourself and determine what kind of "page" you're on when you're in a template. Plugins can also inject their own variables into the system.</p>
  
  <p>Craft's documentation on <a href="http://buildwithcraft.com/docs/routing" rel="nofollow">routing</a> is a good place to reference on this as well, especially if you're used to another system where a certain file/folder structure is implied. Everything is up to you so your templates can be as messy or clean as you want them to be. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-26T15:27:08.947Z
Answers.Text: Thank you for the explanation. That documentation on routing is especially helpful.
Answers.UserDisplayName: kr37
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-05T17:03:39.100Z
Answers.Text: Could you clarify how to see the variables available on a section index?
Answers.UserDisplayName: ponies
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-11T18:46:01.470Z
Answers.Text: @ponies: not sure what you mean? Craft doesn't really have any special variables set for the section index like it does for ``entries`` or ``categories``.  Usually to setup a blog section, for example, a Structure or Single section can "house" that content.
Answers.UserDisplayName: RitterKnight
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-11T18:58:21.380Z
Answers.Text: @RitterKnight I assumed a section id would be available to the index template automagically like the entry. It seemed like a reasonable default.
Answers.UserDisplayName: ponies
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-11T19:22:46.277Z
Answers.Text: Yeh I wish there was a better way to handle section indexes on the author side.  TBH I think Craft keeps the index up to the developer because it doesn't really know what the intentions are for that template. (Do you bring in 10 entries or all 300K for example?) If you bring in the section information, you likely still need to query for the content contained anyway.
Answers.UserDisplayName: RitterKnight
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-11T19:25:11.193Z
Answers.Text: See also this [question and answer](https://craftcms.stackexchange.com/questions/17809/many-sections-use-one-template-how-do-i-get-current-section).
Answers.UserDisplayName: RitterKnight
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-26T04:35:57.187Z
Answers.LastActivityDate: 2015-05-26T05:31:09.760Z
Answers.LastEditDate: 2015-05-26T05:31:09.760Z
Answers.UserDisplayName: RitterKnight
Body: <p>complete newbie question here. Craft is so well designed, I could probably work it out, but it seems like this simple info might help others as well.</p>
  
  <p>So here goes, a two part question:
  1. Is there a simple list of the types of pages Craft outputs?
     (like single-entry, single-category, search-results, etc)
  2. What are all the variables available to each of those?
     (single-entry has a variable called 'entry', plus the globals, I think)</p>
  
  <p>Thank you!</p>
  
Tags: <templating>
Title: What variables are available to what template types?
ThreadText: # What variables are available to what template types?
  
  (Asked by: username_0 on 2015-05-25)
  
  complete newbie question here. Craft is so well designed, I could probably work it out, but it seems like this simple info might help others as well.
  
  So here goes, a two part question:
  1. Is there a simple list of the types of pages Craft outputs?
  (like single-entry, single-category, search-results, etc)
  2. What are all the variables available to each of those?
  (single-entry has a variable called 'entry', plus the globals, I think)
  
  Thank you!
  
  **Tags:** templating
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-05-26. Score: 2 | Accepted answer
  
  It looks like you're coming from some other system? When I see "single-whatever" I think of WordPress' specific template structure... which may or may not have any meaning in Craft.
  
  Unlike something like WordPress where there's a very specific structure to how you get information and what template determines how it behaves, Craft is a bit more open-ended (and DIY) in that regard and that can lead to some confusion, especially if you try to setup something like a [search page](http://buildwithcraft.com/docs/templating/search-form) and then try to use `entry` as variable (which won't be defined, unless you define it yourself).
  
  ***1. Is there a simple list of the types of pages Craft outputs?***
  
  Unlike other content management systems, Craft really doesn't have a concept of "page types". One of the great things about Craft (and probably slightly confusing when you first start) is how you reference content throughout the system in the same, simple way.
  
  You probably know that Craft holds your "page" content in what are called [Entries](http://buildwithcraft.com/docs/sections-and-entries). Think of Entries like Pages since they can map to a URL but they don't necessarily have to...
  
  ***2. What are all the variables available...***
  
  Templates more or less work the same throughout. Craft's [Globals](http://buildwithcraft.com/docs/globals) are available no matter which template you're in, but Craft really allows you to fetch any piece of content (user, asset, tag, entry, etc.) anywhere you need it.
  
  But what I think you're kind of asking about is when you view an entry or category specifically...
  
  If you setup your sections/categories to have a URL/slug that Craft knows about, Craft automatically will populate the `entry` or `category` variable for you so you can access things like title, slug, and any custom fields you might also have on that entry or category.
  
  It's basically a shortcut so you don't have to get it yourself and determine what kind of "page" you're on when you're in a template. Plugins can also inject their own variables into the system.
  
  Craft's documentation on [routing](http://buildwithcraft.com/docs/routing) is a good place to reference on this as well, especially if you're used to another system where a certain file/folder structure is implied. Everything is up to you so your templates can be as messy or clean as you want them to be.
  
  > **Comments:**
  > **username_0**: Thank you for the explanation. That documentation on routing is especially helpful.  
  > **username_2**: Could you clarify how to see the variables available on a section index?  
  > **username_1**: @username_2: not sure what you mean? Craft doesn't really have any special variables set for the section index like it does for ``entries`` or ``categories``.  Usually to setup a blog section, for example, a Structure or Single section can "house" that content.  
  > **username_2**: @username_1 I assumed a section id would be available to the index template automagically like the entry. It seemed like a reasonable default.  
  > **username_1**: Yeh I wish there was a better way to handle section indexes on the author side.  TBH I think Craft keeps the index up to the developer because it doesn't really know what the intentions are for that template. (Do you bring in 10 entries or all 300K for example?) If you bring in the section information, you likely still need to query for the content contained anyway.  
  > **username_1**: See also this [question and answer](https://craftcms.stackexchange.com/questions/17809/many-sections-use-one-template-how-do-i-get-current-section).  
  
  ---
  
  