One of my earliest projects for Drupal was the dashboard. A very simple project, one that does just the minimal necessary to accomplish its goal and no more. At the time, I had lofty goals for the project, but then as time wore on and Views took over my Drupal life, that seemed far away.
Last week, insomnia hit me. (Note: It still hasn't left.) But my poor luck is to the benefit of many Drupal administrators, because my lofty goals have been realized. What are those goals? A system with flexible layout systems. Dashboard could only do the simple top, left, right and bottom. You could embed dashboards within dashboards to get complicated layouts (and I have) but that could be extremely tedious.
And of course, getting the content in the dashboard often meant using a PHP snippet; I'd made it as easy as possible but PHP is PHP and that can still be a pain.
But with the panels module, it's just clicky clicky, and your content is there.
But that's not all! Content types are completely pluggable. By default it supports blocks, nodes, and custom (which is a title and a textarea you put text into) but it's relatively straightforward to plug other content types in, and configure them.
And layouts are pluggable! All they require is a tiny bit of PHP describing them, a theme function which is mostly HTML, and a CSS to place things properly.
So this system isn't quite feature complete, but it's perfectly usable. All I really intend to add to it are access control and Views integration, and perhaps more layouts. Honestly, I think I will leave that to others. I'm sure there are people out there who want a 9x9 layout, and I'm just as happy to let them put it together, create the icon, and submit it as a patch.
Now, some screenshots.
First, picking a layout is visual:
And you're presented with this:

Which you can fill in to something like this:

And that will result in this:
Some caveats:
This isn't a replacement for your block administration. But I bet you wish it were. I do to. Maybe it will be.
No access control. Right now you make public pages. This is on my list (the db is there and a function is there, but it just returns TRUE right now).
Not a node. The original dashboard was a node. This is its own entity. It doesn't really benefit from being a node.
It might take some extra CSS to really make this look nice. It doesn't put any padding of its own in the current layouts, and perhaps it should. And maybe the next version will. And blocks are often assumed to be outside the main content area and might well need to be restyled within the panels.
I hope people find this as useful as I think they will!
| Attachment | Size |
|---|---|
| screenshot-1.jpg | 13.74 KB |
| screenshot-2.jpg | 42.8 KB |
| screenshot-3.jpg | 42.21 KB |
| screenshot-4.jpg | 71.75 KB |

Gorgeous!
Does this replace the main content area, or the entire page display?
Main content only
It is the main content area only, and for a single page. I think one of the real problems with a system like this is how easily it'll be confused with blocks and regions, because they are so conceptually similar.
ideas
i think many people will want to define this for whole page. and they won't want to go into block admin and shut off ervery block for everyone one of these pages.
we should add a hook into theme('page') or regions or other where a path can declare that it doesn't want blocks. then, this module could just offer a checkbox tited 'include standard blocks' or somesuch.
patch is in
the patch for omitting blocks on a page is at end of http://drupal.org/node/76824. the whole beginning of the issue is no longer relevant.
committed
the page is committed to HEAD. panels should simply use theme('page', $output, FALSE)
It's not that simple. I
It's not that simple. I don't necessarily want panels to ignore blocks, that's not actually what I designed the module for. Right now Panels can't adequately replace block management anyway.
So there needs to be some work to make it a proper option, and block.inc needs to be extended to support some of the same things that blocks support. and probably a region.inc to simply include a region if you want to do that.
patch is in
the patch for omitting blocks on a page is at end of http://drupal.org/node/76824. the whole beginning of the issue is no longer relevant.
oooooh
very very nice.
as usual, it will be the small css tweaks that make this look as great as possible. i wonder if you could publish a style guide so that themers add these styles to their themes. out of the box prettiness would be nice.
if i'm not mistaken, this is how MAMBO and some other CMS handle page creation. Nice to see Drupal getting this as well.
That would be *awesome*
It would be relatively trivial to do by URL as well if one wanted, in the theme, without hacking core. It's a small bit of PHP, but it is worth putting into the README as a useful technique for now. For a core submission, I think you're right, that's a really good idea.
How about panel sections?
Or what about extending this so that each panel optionally defines a whole section rather than just a single page (maybe defining sections using the arguments after the panel url)? I have thousands of nodes on some of my sites and can't imagine trying to create dozens of one-off page layouts, but being able to define this sort of panel layout for a whole section would be really awsome. As moshe mentions, we need a way to turn off regular blocks in the section. Then you create a panel for each distinct section of the site, define a block on the page where the nodes in the section will go (could be a simple as selecting an embedded views view that is filtered appropriately for the section and is set up to display as full nodes) and voila -- a nicely customized site with a minimum of work even if you have thousands of individual nodes.
Another option, define a panel for a content type and have all content of a that type displayed in the appropriate panel layout?
Maybe I'm going beyond what you intended, and yes I know you can do some of these things now by theming, but this approach would be much easier for non-coders. It is the sort of thing you could make available to group admins in og or to other casual users that shouldn't be altering files in the theme folder.
Very very nice. I sure am glad you're not getting any sleep :-)
thank you & and some initial thoughts
first of all thank you, for the idea and your efford that even cost you an insomnia that you mentioned,
my initial thoughts are that I presume your module will significantly alter the way Drupal themes code done so far. I wonder what a minimum simplified theme - that is minimalised -skimmed- theme would be?
Secondly if your module used with or integrated with modestyle.module that would be a perfect match to improve further theme editing of Drupal
Third is how css styles online editing also can be integreated you your module?
Well, this doesn't really
Well, this doesn't really affect a theme, per se, but a single content area. For example, on the page you're viewing now, you might consider the content area to be a '1 column panel' and it's unaffected by the fact that i have blocks to the right and to the top.
That said, the theme *could* be viewed as a 2 column stacked panel with column A set to a fluid width. Which is certainly what people would like to see...but that part isn't what panels.module does. That's a level *higher* than where panels works.
I'm not familiar at all with modestyle, and online CSS editing is way beyond the scope of panels module for the reasons outlined above.
Images
I cant seem to add images in the Panels....
1) Issue queue 2) bug
1) Issue queue
2) bug reports need more information than does not work. What do you mean images? Be specific or I hit you on the head with a frying pan.
3) Bug reports go in the issue queue, not as comments on my blog
Panels Howto
How do I publish a panel to the front page and make it sticky at the top of list. Publishing options dont appear in the "Panels" page. Also dashboard did not have teasers. Does the panels module support teasers.
you can't
Panels are not nodes and don't have publishing options.
You can give the panel a url and set it to your front page using administer >> settings and change the 'default front page' to the url you specified.
checkbox
i was thinking that the panel creation form has a checkbox where admin can omit standard blocks. i think that addresses a big use case (true - not every use case). admin can then add back the desired blocks within panels framework.
Problem displaying in IE
Hi, I'm a newbie. I am using the Panels module and created a page with a top, bottom, left and right areas. The layout looks ok on Safari and Firefox but in IE the right area is pushed down below the left area instead of where it should be, ie. on the right. Is there something I might have done wrong?
It's probably padding. IE hates padding
In your CSS, for whatever the panel is being displayed in (often 'content' or 'maincontent' or the like) make sure it has no padding.
Awesome!
Awesome work. Thanks.
Is this how you created the 'Assign Blame' front page? Are there are tutorials anywhere that would include most things needed to create a page like that? (E.g. Create taxonomy terms like so, install Panels, etc.) I could have really used something like that a year ago.
Thanks again.
assignblame is actually
assignblame is actually still running my original 4.6 custom code, but could easily be replicated using nodequeue, panels and views now.
Here's a short version of how to do that:
1) Create a taxonomy vocabulary and call it something like article type. Give it terms such as 'sports, international, us', whatever.
2) Create a view which uses taxonomy as an argument. The block form is a list view and the page form is a teaser view. You can clone the basic taxonomy/term view to accomplish most of this with only a little bit of tweaking.
3) Create a nodequeue of size 1 and call it 'Featured Article'. Create a view that filters on this node queue.
4) If you like, create a second nodequeue for the alternate feature (what I use for goat of the week).
5) Create a 2 column stacked panel. In the top section, put the nodequeue view. Sprinkle the block views for your various taxonomy terms in the panel where you like.
There's ONE thing assignblame does that none of this does by default, which is if the block views have fewer than 5 records, it adds blank entries. But you can accomplish this by theming the view, counting the actual number of entries and going with it. I think assignblame also makes the title of the block a link, which isn't normal either, but could probably also be themed. That might be a touch more difficult to do but is possible I think.
Thanks, Merlin.
Thanks, Merlin.
Panels for OG?
I find the panels module an incredibly useful tool, thank you for making it. Is there any chance of adapting so that it is useable on OG homepages?
love this module - can extend with Aymans drag drop interface
Hi Merlin, Another great module, Thanks so much.
You may be interested to know of some great stuff Ayman is doing. For example his Drag & Drop interface would be a great fit with panels. Currently he created a demo for a personalizable portal.
He has also just revised it using jquery Ajax instead of the original scriptaculous. Here is his original post about it: http://aymanh.com/drag-drop-portal-interface-with-scriptaculous
I pointed your panels module out to ayman as he was looking for a good use of his drag/drop portal interface. And seemed to be an obvious fit.
Thanks again for your great modules merlin, they really make a huge difference
Panels and the Category Module
Merlin,
i would like to make the node body of either a category_module container or category be replaced by the contents of a panel?
Some thoughts i had to solve this were:
1) drupal has API calls that allow one to insert an existing block on a page.. you just need to know the right API call, the module that created the block and the delta (instance) of the block. So i'm wondering if there is maybe a module_invoke or something on panels, that i could call from within the category/container php snippet block that would allow me to take the contents of a preexisitng panel and insert it into the node body of the cat_module container or category? hope you followed that. btw this functionality would have to exist in the panels module.
Alternatively, these methods would require implementation in the cat_module probably (and maybe some support in panels/views)
2) thought there might be a way to enable cat_module categories and containers ON a panel - in otherwords allow a panel to function as a category/container (right now you can enable categories and containers on node types if you choose)? I don't think panels are nodes or have any assoication with the drupal concept of "types" though, so i'm not sure this would work unless the cat_module added some extra code
3) simply allow a cat_module to have altnerative sources for node body: including views, panels etc. This probably would be much easier to implement.
For right now though, solution number 1 seems like the simplest and most straightforward and probably already exists, i just don't know how to access the panel through the api.
thanks in advance
print panels_panels_page($did);
See author's post here:
http://drupal.org/node/100370
I need this too
I'm trying to use panels.module for my OG group homepages. If you find the solution for this, I want it too!
When I updated my site to
When I updated my site to drupal 5.1, my dashboards became unavailable. Is there a way I can retrieve the content from my dashboards and convert it to either panels or regular node pages?
Post new comment