Hello,

I am using a couple panel pages that are using the
same view with different args in each pane.

A view is set to not show (404) if there are no values.
I have the panels set to override the title for each pane,

before the latest upgrade to 3.2 the display showed fine.
now all of the panes show the overridden title even if there are no values.

I reverted back to last version to double check and the panes are gone (the ones with no values).

Is this expected behavior? Do I need to find a different way to hide the no value panes?

Thanks!

Comments

merlinofchaos’s picture

The temporary workaround for this is the following:

Copy panel-pane.tpl.php into your theme.

Edit your new panel-pane.tpl.php and at the very top, add this:

if !empty($content):

And at the very bottom add this:

endif;

This will have to do until I figure out the right way to fix this.

reload’s picture

Thank you merlinofchaos. This works when the title is not overridden,
but I suppose there is something in the $content array when title is overridden?
I also tried $content['middle'] with same results.

merlinofchaos’s picture

No, $content is just the content. In that template, $title is the title. They are rendered separately.

merlinofchaos’s picture

http://drupal.org/node/613006 marked as duplicate of this issue.

reload’s picture

Thank you again merlinofchaos. I grabbed the wrong tpl file.
templates directory much to obvious ;)

merlinofchaos’s picture

Status: Active » Fixed

Ok, checked a fix into -dev that should take care of this.

blueblade’s picture

Hi merlinofchaos,

I tried but it doesnt seem to work. Can you see if I am doing it right?

<?php
if !empty($content): 
?>

<?php
// $Id: panels-pane.tpl.php,v 1.1.2.1 2009/10/13 21:38:52 merlinofchaos Exp $
/**
 * @file panels-pane.tpl.php
 * Main panel pane template
 *
 * Variables available:
 * - $pane->type: the content type inside this pane
 * - $pane->subtype: The subtype, if applicable. If a view it will be the
 *   view name; if a node it will be the nid, etc.
 * - $title: The title of the content
 * - $content: The actual content
 * - $links: Any links associated with the content
 * - $more: An optional 'more' link (destination only)
 * - $admin_links: Administrative links associated with the content
 * - $feeds: Any feed icons or associated with the content
 * - $display: The complete panels display object containing all kinds of
 *   data including the contexts and all of the other panes being displayed.
 */
?>


<div class="<?php print $classes; ?>" <?php print $id; ?>>
  <?php if ($admin_links): ?>
    <div class="admin-links panel-hide">
      <?php print $admin_links; ?>
    </div>
  <?php endif; ?>

  <?php if ($title): ?>
    <h2 class="pane-title"><?php print $title; ?></h2>
  <?php endif; ?>

  <?php if ($feeds): ?>
    <div class="feed">
      <?php print $feeds; ?>
    </div>
  <?php endif; ?>

  <div class="pane-content">
    <?php print $content; ?>
  </div>

  <?php if ($links): ?>
    <div class="links">
      <?php print $links; ?>
    </div>
  <?php endif; ?>

  <?php if ($more): ?>
    <div class="more-link">
      <?php print $more; ?>
    </div>
  <?php endif; ?>
</div>


<?php
endif; 
?>

uomeds’s picture

Didn't work for me either. Gave me:

Parse error: syntax error, unexpected '!', expecting '(' in /public_html/sites/all/modules/panels/templates/panels-pane.tpl.php on line 2

I'll try the dev.

merlinofchaos’s picture

You need to wrap the condition in parentheses:

<?php if (!empty($content)): ?>
...
endif;

uomeds’s picture

Okay now that worked like a charm. Thanks. :)

blueblade’s picture

I think it's working for me too now =) many thanks!!

Status: Fixed » Closed (fixed)

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

ayalon’s picture

This works only for panes without styles/borders. If one uses this code the outer html code f.ex. for the grey borders will still be rendered.

HLopes’s picture

You can use the same method if you're using the round corners style, just edit

panels-rounded-corners-box.tpl.php

in panels/styles/corners, so it reads

<?php if (!empty($content)): ?>
<div class="rounded-corner">
  <div class="wrap-corner">
    <div class="t-edge"><div class="l"></div><div class="r"></div></div>
    <div class="l-edge">
      <div class="r-edge clear-block">
        <?php print $content; ?>
      </div>
    </div>
    <div class="b-edge"><div class="l"></div><div class="r"></div></div>
  </div>
</div>
<?php endif; ?>