Fork me on GitHub

A Preview of PyroCMS Page Types

posted 2012-12-03 by Adam Fairholm

menu1.png

For the upcoming 2.2 release of PyroCMS, we've been working on integrating Streams into the pages fields. We went through several revisions of how that should actually work, and we're really happy with where the feature has ended up. The idea behind streams is that a single data system gives a CMS more power to manage and structure content, and page types is a major step towards making that happen in PyroCMS.

2.2 isn't out yet (we should have a beta in the next few days), but I've gotten a few questions about how page types will work, so here's a feature overview.

Video Demo

First off, to see page types in action, check out this quick demo to see it in action. It only took me 14 tries!

What Are Page Types?

form.png

Let's say you have a site of products. Each product has its own page. In the past, you would have to create a project display page in the page tree, and then display that product using streams tags. You still may want to do that, but now you have the option of having data entries represented directly in the page tree with page types.

A page type is a layout that is tied to a specific stream, so when you create a page, you fill out the data for a stream entry as well as the page fields. Then, simply use the fields from the page/entry in your layout. No pulling data from the URL necessary.

Plus, your data is still a stream. That means, if you have the streams plugin that comes with the streams module, you can display it in a cycle loop, create entry forms for it, whatever you'd like! We designed page types with maximum flexibility in mind for your content.

What Streams Can be Attached to a Page Type?

Any stream. You can choose an existing stream from any namespace, or the pages module will create one for you (in the 'pages' namespace). Also, multiple page types can use the same stream.

I Already Use the Stream Module. How Would I Use Page Types?

Let's say you are building a website for a business that has a few locations. You want to create a location index, and then have a page for each location. You've got a stream called Locations with all your location fields (address, etc.) and you want a page to display each one.

So, you'd create a page type called Location and choose your Locations stream when creating it. Add in your display logic for how to display the location in Then, when you click New Page, you can choose Location as the page type, and then add in your location data into your location fields. Your location is now both represented in your page tree and in your stream. You can use either the streams plugin or various functions in the pages plugin to list your locations as well.

I Don't Have The Streams Module Installed, Can I Still Use Page Types?

Definitely! When you create a page type, you just select the option Create New Stream for this Page Type. Once you've created the page type, you can create fields right in the Pages module. No streams module needed.

Are Page Types in Community?

Yes, they are. Community has the Streams Core module and the Stream API which allow modules to integrate streams in the community version as well as Pro. Page types is a PyroCMS Community feature.

What About Chunks and Page Layouts?

The migration from page chunks/layouts to page types is pretty simple. Page layouts become page types and are all assigned the default page stream, which has one field. That one field houses all of your chunks. So in short, your chunks will still be in tact. We recommend moving off of chunks, but they will still work.

Anything Else Fun I Should Know About?

Yes - several new features were created during the page type development process:

  • Through a new Event in 2.2, you can enable a field_types folder for your module where you can put module field types.
  • You can now save page type layouts as files. It will also save the page type CSS and JS as files.

When Can I Try It?

We're still testing internally, but a beta should be available later this week. Until then, feel free to ask questions on this post!

Comments

Gravatar
Dev21

2012-12-03

Great !!!
possible to add mulilanguage fields ?

Gravatar
Cmfolio

2012-12-03

Love it! I can't think of an easier solution in any other CMS. Well done boys.

Gravatar

2012-12-03

AAAaAAaAAAaAaAAaaAaAAAaaaAAaaAAaaAAa!!!!!!!!!!! THIS IS CRAZY AWESOOOOOOME!!!!!

Gravatar
Wolfram

2012-12-03

Hi PyroCMS Team,

that´s great news for clients and developers! I really like how you are integrating the streams with a lot of flexibility and control. And being able to work on the layouts in an editor is another major improvement I think.

Thanks for the well thought out progress of PyroCMS!

Wolfram

Gravatar
Tom Dickie

2012-12-03

This looks really impressive. I can't wait for the beta. I could really do with this feature right now!

I'm curious if there would be a way of creating a listing page of pages? Would you use the streams cycle plugin on a parent page, could this be achieved without the streams plugin?

Gravatar

2012-12-04

Good news ! :)

And what about a new / an upgrade of the WYSIWYG editor ? CKEditor is so painful sometimes (often)... :(

Gravatar
Ryan Thompson

2012-12-04

Righteous.

Gravatar

2012-12-05

@Dev21: This hasn't been built in, so it depends on your setup and what you want to do. Feel free to email me at adam@pyrocms.com if you have some ideas for language integration.

@Tom Dickie: There's a few ways to tackle this. The fields data is still a stream you can easily cycle through that. You can also use the page plugin to cycle page data. Either way, you'll be able to list out pages.

@Tristan Jahier: Any suggestions for a replacement? I'm afraid besides TinyMC and CkEditor I'm not really up on the text editor world.

Gravatar

2012-12-05

@Adam Fairholm: I don't have any problems with ckEditor but maybe:

http://www.aloha-editor.org/features.php

Gravatar

2012-12-07

@Adam Fairholm : CKEditor 4 has just been released for a couple of weeks. It seems to be smoother, or at least prettier. It even provides inline-editing.

WYSIHTML5 is an interesting project too. It seems to be lightweight and simple. The code generated is plain HTML5.
http://xing.github.com/wysihtml5/

Gravatar

2012-12-10

I'm looking forward to the new feature. Is beta going to be available this coming week?

Gravatar
Tom

2012-12-10

Any closer to a beta preview of this?

Cheers
Tom

The ability to leave a comment has been disabled for this article. This is because it's a little old and we get spammed pretty hard.