0

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!

2

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 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. 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 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 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.

  • Thank you for the explanation. That documentation on routing is especially helpful. – kr37 May 26 '15 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.