5.7 Page Types vs Templates5 users found helpful
Now with 5.7, Page types still represent types of page (a standard 'Page', 'News Item', 'Portfolio Item', etc), but it doesn't have a _direct_ relationship with a template. It means that you can now have a 1 to many relationship between page types and page templates.
The page type and page template itself have been decoupled.
Page attributes and composer stuff is related to a Page Type, but a Page Type now can be configured to use one or more (or all) available Page Templates a theme provides.
For an example, you can now do something like:
- Create a Page Type called 'News'
- Create three different various of a news layout, three different Page Templates (e.g. 'Standard Layout', 'Video Layout', 'Multi-column Layout')
- Configure the Page Type to allow only those three page templates to be used
- Also set different default blocks across the different page templates
Then when you create a news page, you can go to the design sidebar and change the layout to a different template _without_ changing the page type. This is really critical when you consider that things like the Page List block can do things like filter pages by page type. When you change a page type, you may find it disappears from filtered Page Lists or appears on others.
In many cases you still might end up with 1 to 1 relationships between pages types and page templates, as your different page types might need only one layout each, but now you've got to the option of one or more layouts.
Its one of those features that doesn't really seem that useful until you need it to solve a problem, then it all falls into place. With bigger sites it's really important to be able to use the 'Page Search' feature of the dashboard, to filter and manage pages by page types. Splitting the type of page from it's layout makes this much easier to manage.
I haven't done much myself with Page Type controllers in 5.7, but I would assume they would pretty much the same way as in 5.6, the controller is associated with the Page Type. The templates are really just a way to quickly change the _output_ of the page type, but I don't believe they have any controller logic behind them.
Well said, thank you.
(Curious - how did you find out how that all worked? Did someone tell you or do you just have an awesome grasp of 5.7 ? :)
From about a minute in, Franz briefly goes through the concepts of page templates and types. It's one of those cases where once you've got the high level picture in mind, the new features start to make a lot more sense.
I see the following when I try to understand the difference between Types and Templates:
Looking at these links there is NO difference!
What is Page type? HTML + PHP? HTML only?
What is Page Type? HTML + PHP again? HTML only? Are these files at all? Images? can someone give examples?
You're better off comparing:
The higher level page actually gives quite a nice summary of what these things are:
In short, Page Types are more like categories of page, it's more a data structure with individual pieces of information (attributes). They don't have a php template for them, as they're just data structures, they have no appearance by themselves.
To use the language from the doco, Page Templates are 're-usable visual formats for the various kinds of pages on your site'. These do have corresponding php files to define their code/layout.
Where the doco you linked may have confused you is that back before concrete5.7 these concepts were one and the same thing, you defined the type of the page _and_ the layout with the one thing. Now they're two separate concepts.
With that in mind, perhaps re-read my example above and hopefully it'll click!
<div id="industries" class="row"> <?php $a = new Area('Industries'); $a->setAreaGridMaximumColumns(12); $a->display($c); ?> </div>
It is impossible to ad a layout to the area. It is just not stored..
Any idea's why?
I am not positive about this, but I think page templates need to go in the theme root, not in a folder.
You could try:
What I was excited about with Page Types / Templates, was the ability to have a master template that could be used by several Page Types, but with the ability to get into each defaults independently. I find much more useful the ability to have a template that can accommodate different defaults on it's regions than the opposite. I'm not saying what it's now is bad, on the contrary, I think I'll be using it too, just that if it was the opposite, I'd use it a LOT more.
Right now, if I go to the defaults of a Page Type, it sends me to the defaults of the template, which is not that useful because I could just hardcode everything needed in the template, for each Page Type on the other hand, independent defaults would be awesome.
I have a 5.7 site that has one master template and about 8 page types, each with their own defaults.
I've used page types for each section of my site - events, resources, membership, about, etc... these are all page types. They use a single master template for layout.
Sections differ by their header (a banner for the section, which I used as a embedded stack using defaults) and the sidebar contents. The sidebar default content changes depending on what section Page Type you create. I used defaults for the sidebar as the contents are completely editable by the page, but most pages would have the default sidebar.
Is this the kind of thing you are trying to achieve?
Thank you so much for pointing me wrong.
Is this a bug? What I change in the defaults don't apply to that page, but if I create a new one of that type, then it gets applied. When doing Setup on Child Pages, it doesn't even appear there. What am I missing?
I have not had the situation where I created the page first then the Page Type so I am unsure.
I did have weird errors with the page types when I started (I can't recall the wording) but I wasn't even able to access them - I kept getting blocked by SQL errors. I have C5 set up as a central install for multiple sites so I assumed it was an issue with this. I ended up deleting all the Page Types and existing pages so everything was "clean".
Perhaps record a short video with Jing or similar and post as a bug?