using panels 2 everywhere

Events happening in the community are now at Drupal community events on www.drupal.org.
sime's picture

We're happily using Panels 2 in our latest site. We're using panels for all node types and suppressing everything else around the panel (ie. we're not using the block config page much at all).

We'd now like to create a default panel to use on every page that is not currently a panel - this will make theming totally consistent - no designing css for both html output scenarios.

Just trying to work out how to do this! Say I have node/add, and I override it with %. We can get what we want, but I'm just struggling to work out how to add the normal content in the middle. Either I should be doing it this way and somehow finding the overridden active menu handler and calling it, or I should be intercepting the output in the template and loading a default panel if the page is not already so. I'd prefer the earlier option.

I'm probably missing something simple...

Comments

Basically, you do have to

merlinofchaos's picture

Basically, you do have to somehow find out what the original menu handler was, call it, and return a value. In Drupal 6, this isn't too bad since we could use hook_menu_alter and, if the path already existed, we can store that data and do something.

In Drupal 5, I'm not exactly sure how to go about doing that, since the act of overriding a path obliterates the original data, and there's no way to get it. This is something I've really wanted to accomplish...but the only way I can think to do it involves an alternative index.php that does smart routing. And therefore doesn't actually use panel pages.

check the global $_menu?

sime's picture

_menu_build constructs a global $_menu. Could panels_pages_menu() check this and make a guess about which path will be overridden - then store any special information it needs to attempt the callback later?

In some cases the callback will be obvious, where it is not obvious (if that happens), just don't override the menu.

I don't think this should

merlinofchaos's picture

I don't think this should work; $_menu isn't created until after hook_menu() is called entirely, so all of the information won't necessarily be available.

theoretically unsatisfactory

sime's picture

FWIW, I hacked D5 a little.

In panels_page_menu() I found that using logic similar to menu_execute_active_handler() on the global $_menu I was able to statically store the callback info for later.

But it's not very pretty and I'm sure there could be problems. I think I'll tell the designer to theme both ways.

alternative approach via theme

sime's picture

Instead of menu override, my last shot is to get into theme layer

  • detect if there is no active panel
  • load a panel, modify it by adding the $vars['content'] into whichever pane
  • render the output back into $vars['content']

I remember looking at this a while ago, maybe I even found an example of using the panels API like that, but googling it I cannot find it again. Any hints appreciated, I'll have another look at the API.

update

sime's picture

I've written up a tutorial for doing this in D5 with Panels 2 beta - requires editing template.php
http://drupal.org/node/232644

Note: You do not need the

merlinofchaos's picture

Note: You do not need the pid of the panel. The panel NAME will do; Panel-pages work like views. The ID is a database ID, but panels do not need to be in the database at all.

One more comment: node/add

merlinofchaos's picture

One more comment: node/add is a bad example, because panels can actually do node/add very nicely. There's a node add form argument.

(What it can't do is add comment. That kind of sucks.)

updated

sime's picture

Thanks merlinofchaos - updated.

Is this topic still active?

surge919's picture

I've been testing Drupal for the last few weeks and recently started working with Panels.
As a newcomer to Drupal, I'm finding it very hard to find information..between the forums, comments under each module, etc.

I'm trying to get panels 2 everywhere working but I'm not having much luck. I've followed the steps from http://drupal.org/node/232644 but my page still doesn't show up correctly using my custom panel. It simply shows the content of each page?

I think I figured out some of the issues that I posted elsewhere and can post more information, but where is the right place?

If anyone has the panels everywhere working, can you please Export your panel so I can import it as a starting point?

thanks,
tom

subscribe

iaminawe's picture

subscribe

subscribing

mrgoltra's picture

subscribing

edited

hasc's picture

edited

hook_menu_alter

hasc's picture

I am a little frustrated since after over an hour of research i can not find one working tutorial/example/description explaining how you actually use the hook_menu_alter to use panels everywhere (Drupal 6, Panels 3) of how you inject the content as a pane. I always only read how easy it is without a piece of example.

I am defenitly unexperienced with drupal in general but i find i quite hard to find up to date documentation. Maybe there's also a lack of patience on my side...

regards,
hasc

Panels 3 just had an official

merlinofchaos's picture

Panels 3 just had an official release. I'm pretty sure no one is yet using it Everywhere, and if anyone has said it's easy, it's not yet there. It's a direction I want to go and it's definitely what I want to do, but we aren't there yet.

sorry i read that in a few

hasc's picture

sorry i read that in a few posts without actually saying how it is done. it is propably not the best moment for starting to use it.

i ll goe ahead with researching and if i managed to find a proper solution before i give up i'll post it.

edit:
right, i propably just read that thats the way how it is done.

regards,
hasc

Easy?

michelle's picture

Where did you read how easy it is? I want some of what they are smoking. :) I have lots of Drupal experience and have been using Panels since Panels 1 and I wouldn't consider using Panels everywhere on a site to be easy at all.

Michelle

Panels

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: