A rough introduction to building a page in Panels 3
Posted 04/27/2009 - 13:57 by Michelle
Note: The CTools / Panels UI has changed drastically since this article was written, so much of it doesn't apply anymore.
This article is for folks used to making Panels pages in Panels 2 feeling bewildered by Panels 3. I wrote it quickly while my son had lunch and it's not polished at all but it may help some folks until there are better docs. I'm assuming you have bleeding edge Panels 3 and CTools installed for this.
If you go looking to add a page under the main Panels menu, you won't find it. Instead, you need to go to Site Building -> Pages (admin/build/pages). On that page, you'll find a list of existing "System Pages" as well as the ability to create your own. If you are overriding an existing Drupal page, such as the user page or node pages, this is the section you want. If you are creating a brand new page, you'll want the other section. So far I've only overridden the user page so that is what I'm going to use as an example.
Find the line that says "User view" and look all the way to the right for the word "Operations". Click on that. You'll see an option pop up for "Task handlers", which is some new lingo we got in Panels 3. My understanding is that a "task handler" is one of possibly several items that potentially handle the task of showing the page. What this means is that, unlike Panels 2 where you had only one Panels page per path, you can have multiple possible Pages for a path and set the rules for which one is used when the page is viewed. So click on "Task handlers" and let's get started making one.
In the "choose" dropdown, choose Panel and then add new handler. You are then taken to a page where you can determine access control. I haven't played with that, yet, so just continue. Then you need to choose a layout. Be aware that only the flexible layout lets you use the fancy layout tool at this time. If you choose any other one, it's static. For our example, choose flexible and then continue. This takes you to the add content page.
Click on "show layout designer" and the screen will change. Flexible starts you out with one region for adding content. Odds are you'll want to add more. Take some time to plan out how you want to do it because it can be tricky to move columns/rows around once you have content in them. How it works is this: The "canvas" lets you add columns. Columns let you add rows. Rows let you add either regions or more columns. Notice that the canvas won't let you add rows. That's very important. If you start out with a left and right column in the canvas and then decide you want to add a footer row across the bottom of them, you're out of luck. To do that, you need to have one column in the canvas, add two rows to that, and then put your side by side column in the first row. It's a bit tricky to get your head around, which is why pre-planning is a good idea. Once you have your structure of columns and rows, you'll want to add regions into each one. Regions are where you actually put the content.
In addition to adding columns, rows, and regions, you can use the grippy bars to make columns wider and narrower and the settings to make them fluid or fixed. You can run into some trouble with some combinations of fluid and fixed. If you get a division by 0 error, you have a combo that doesn't work right. Another neat trick is to hold down the shift key while you drag to get it to jump in whole number increments.
Once you have your structure set up, hide the layout designer. You should now see all your regions laid out. Now you can click the plus and choose "add content". This will pop up a dialog with all the content types available for the context you have. What context do you have? At this point, just the user context because it comes for free when you override the user page. If you want to add, say, cck fields from the related content profile node type, you can't do that yet. This is a bit awkward and hopefully will be fixed before the final version. But, back to adding content. Along the left side are the various categories of content types available to you. Pick a category to see the content types in it. For a handy example, click on the "user" category. Then add "user profile". This particular one only has a setting to override the title. Other content types may have more complex forms with various options to set. Continue adding content this way until you have everything you want. You can drag content from one region to another if you decide you don't like where you put it.
When you're done adding content, click finish. And then make sure you save it on the page that comes up. Now go to user/1 (or any other uid) and you should see it replaced by the page you just created. If you want to add more contexts, say a relationship to the content profile node, you can go back to the task handler page and choose "contexts" from the operations popup. Then you will have more content types to add on the add content page. Warning: Don't use the tabs across the top to jump directly from adding contexts to adding content or it will not save. You need to click the continue button at the bottom to save the new context, even though continue doesn't take you to the add content page. Then you can click the link to go to add content.
This article just barely scratched the surface of what's possible. As more people begin using Panels 3, I'm sure there will be lots more in depth articles getting into all the possibilities. For now, hopefully this will get you started.
Site contents are licensed under a
so early back from vacation?u should stay more
Added to DrupalSightings.com
Hi,
I am trying to create a page where a user will have the ability to add content in 2 columns that are fixed in one content area of a region using the Simply Modern theme. First column will have images and the second column will have text. Can Panels 3 work for this?
I tried the example up until "Now go to user/1 (or any other uid) and ..." and saw no difference on the page. I signed in as admin and as a user with certain permissions. Did I misunderstand the use of Panels for this task?
My settings:
- Used 2 Col. Fixed instead of flexible
- Add content: Left Side- Image Block Right Side- Content Block
- Selected Finish then Save
- user/1 gives me my admin/user account page as normal.
Appreciate any help or guidance
Chris
@ddorian: Vacation? I didn't go on vacation... Are you referring to my support break? I'm still doing that. Mostly. I give in and answer easy ones now and then. :)
@Chris: Sorry, but I'm not able to offer general Panels support. I'm merely documenting what I learn as I go along to try and help others that aren't as far along.
Michelle
Okay I understand. Thanks for responding.
I'll try to catch up a bit.
Regards
Chris
Hi Michelle,
"If you want to add, say, cck fields from the related content profile node type, you can't do that yet. This is a bit awkward and hopefully will be fixed before the final version" ...
Do you know if that is fixed in the latest P3 beta1 ?
@charos: Nope. Still need to jump around to get to it.
Michelle
Thanks for the ultra-fast reply! I guess that means that getting P3 for content profile (and APK) is really not going to work yet as expected. I really wonder how people managed to get working content profiles with P3 :) . Once again, thanks for the clarification !
@charos: I don't understand... It's not that adding content for other contexts doesn't work, it's just that the UI is confusing and you have to save your work and then go back in to add additional contexts and then you can add content for them.
I just used content profile as an example of an additional context but, since you brought it up, keep in mind that the relationship plugin hasn't been committed yet.
Michelle
Yes , I misunderstood the situation. I played around with it and now I actually understand what you meant by that.
Michelle,
I just wanted to thank you for a coherent panels doc that used the newest version. I've a drupal newbie and have been stumbling my way through it for two weeks. So far the other panels tutorials are out of date for the newest version, and as you well know trial and error is a slow way to learn.
thanks,
Herda05
You helped me so much.
Thanks
You're welcome. :)
Michelle
Hi Michelle
Please help me. As a Drupal expert could you please help me, and explain why I am getting this ERROR MESSAGE
??? user warning: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '=' query: SELECT s.uid, c.updated FROM ctools_object_cache c INNER JOIN sessions s ON c.sid = s.sid WHERE s.sid != '78344d7f605b1766dfdfaaf85c6d4cb8' AND c.obj = 'delegator_page' AND c.name = 'test_panel' ORDER BY c.updated ASC in /home/filmforf/public_html/sites/all/modules/ctools/includes/object-cache.inc on line 92.????
The above is on my live production site. Please check it at www.filmforfree.org
I also get the same error message when I try to access my Local Host Drupal website.
"" Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 793825 bytes) in C:\xampp\htdocs\drupal\includes\database.mysqli.inc on line 303
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 914098 bytes) in C:\xampp\htdocs\drupal\includes\database.mysql-common.inc on line 41""
Please Please help me.
@Nairaman: Please use the Panels issue queue for support requests. Panels is not my module. I am writing things up as I learn them but am not able to offer advanced support for individual issues.
Michelle
Hello, I have just loaded the ctools and panels 3.0 rc and I don't see the Task Handler option based on your description. Is there another module needed for that extra info? I only see 3 Panel options in the modules section. Is anything missing?
Just trying to learn panels as I am new to drupal and have not had any prior experience with it.
Thanks,
Keep up the great work and sharing it...
@Visitor: The CTools / Panels UI changed drastically since I wrote this. It was for the better (tons better) but, unfortunately, means this article is out of date. I've got an idea for some new docs based on the new UI but no time right now. :(
Michelle