I'm using Drupal 5.7 and Panels 5.x-2.0-beta3. I am creating a panels page and have selected to have all drupal blocks and regions overridden for this page.

In my main drupal install, I am using SEOposition as my main theme, but I use Bluemarine as my admin theme.

When I view the panel in Preview mode, I see the panel in the Bluemarine (admin) theme with sidebars properly suppressed. However, when I follow the direct link to the live panel page, I see the page in the SEOposition theme (which is what I want), however, blocks are no longer suppressed with SEOposition (which is not what I want).

I searched but did not find any clues for this problem. Not sure whether this is more likely an issue for Panels or for SEOposition. Can anyone suggest an idea for uncovering the source of the problem? (Keeping in mind you are dealing with someone with about a year and a half of Drupal experience, but little knowledge of the underlying code.)

Thanks.

Comments

sharique’s picture

subscribing

muhleder’s picture

I spent yesterday trying to work this out and I think I know what the problem is. It's not a panels issue so I doubt it's going to get fixed unfortunately. The suppress blocks option is handled by phptemplate, but as far as I can see is only implemented for the left and right sidebars. ie blocks are only suppressed in the sidebars, not for header, footer or any custom regions. The following code from the phptemplate_page function in /themes/engines/phptemplate.engine is where it is implemented for the sidebars.

Line162

  // Populate sidebars
  $layout = 'none';
  if ($show_blocks) {
    global $sidebar_indicator;
    /**
     * Sidebar_indicator tells the block counting code to count sidebars separately.
     */
    $sidebar_indicator = 'left';
    $sidebar_left = theme('blocks', 'left');
    if ($sidebar_left != '') {
      $layout = 'left';
    }

    $sidebar_indicator = 'right';
    $sidebar_right = theme('blocks', 'right');
    if ($sidebar_right != '') {
      $layout = ($layout == 'left') ? 'both' : 'right';
    }
    $sidebar_indicator = NULL;
  }

You could suppress other blocks by adding an extra conditional in the following piece of code, but the $show_blocks variable doesn't seem to be available in this function ( _phptemplate_default_variables ) again in /themes/engines/phptemplate.engine

Line 112

// Skip blocks in this region that have already been loaded.
      // This pre-loading is necessary because phptemplate uses variable names different from
      // the region names, e.g., 'sidebar_left' instead of 'left'.
      if (!in_array($region, array('left', 'right', 'footer'))) {
        isset($variables[$region]) ? $variables[$region] .= theme('blocks', $region) : $variables[$region] = theme('blocks', $region);
      }

Maybe you could set a global variable when the suppress blocks option is tested in panels_page.module

Line 719

  if ($panel_page->no_blocks) {
    print theme('page', $output, FALSE);
  }

and then test for that variable in phptemplate.engine, or in your theme. Not sure that I'd want to hack a contrib module and a piece of code code myself.

It would be nice to have the option to suppress parts of your theme if on a panel page though, I think a better way to do it might be to test if the page is a panel page using one of the panel API functions. Not sure on the performance implications as it would be called on every page, but at least you wouldn't be hacking core or module code.

sharique’s picture

I put this code in page.tpl.php, but it didn't work.

<?php 
 if (!$panel_page->no_blocks) {
    print $sidebar_right ;
  }

?>
muhleder’s picture

I tried that thing too, but the no_blocks variable isn't available. I'm using the following code in my page.tpl.php

$current_panel = panels_page_get_current();
if (isset($current_panel->pid)) {

MY HTML AND PHP FOR PANEL PAGES HERE

} else {

MY HTML AND PHP FOR NON PANEL PAGES HERE

};

or you can give all your panels urls like panels/* and just disable the blocks individually for that pattern

sdboyer’s picture

Status: Active » Closed (works as designed)

Yep, as muhleder has pointed out, this really isn't a panels issue; there are ways of accomplishing the hiding of all blocks within the theme system itself, but being that they have nothing to do with panels, I'm marking this as by design.

dkruglyak’s picture

Title: Panels2 page sporadically supresses drupal blocks » Panel pages with blocks disabled still show them in preview
Version: 5.x-2.0-beta3 » 6.x-3.x-dev
Category: support » bug
Status: Closed (works as designed) » Active

Seems to me this issue is relevant to what I am seeing with Panels3 beta2, so I am posting it here.

My panel is configured to disable blocks/regions and this works fine. However when I render it in "Preview" mode, these extra blocks do not go away. The result is panel tries to render in a much more constrained space, coming out looking wrong and occasionally spilling over the block regions.

I should add that this preview mode also does not include (or properly apply?) Panel's global CSS - which I am relying on for proper output.

merlinofchaos’s picture

Status: Active » Closed (won't fix)

The preview just comes in in the administrative space that it has. It can't really make the blocks go away during preview. And if it ajaxes in, it might miss css. The preview is, well. Kind of weak. It's useful but not as good as it could be.

dkruglyak’s picture

Status: Closed (won't fix) » Needs work

What about putting preview into a Lightbox or iFrame?

There should be a way to do this. Preview is pretty much useless when constrained to admin box. That is a problem.

stieglitz’s picture

agreed this would be very nice!

dhakshinait’s picture

Status: Needs work » Fixed

disable custom regions in panel page:

1) go to template.php file

find the function " phptemplate_preprocess_page(&$vars) "

and put the following code in that function

if (!$panel_page->no_blocks) {

$vars['YOUR_CUSTOM_REGION'] = '';

}

FOR EXAMPLE.. I HAVE REGIONS CALLED "bottomside"

if (!$panel_page->no_blocks) {

$vars['bottomside'] = '';

}

i think , it will help someone.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.