[documentation] [Documentation feature] Remove block title in footer

webchick drupal-docs at drupal.org
Tue May 2 22:35:51 UTC 2006


Issue status update for 
http://drupal.org/node/41425
Post a follow up: 
http://drupal.org/project/comments/add/41425

-Project:      Drupal
+Project:      Documentation
 Version:      <none>
-Component:    block.module
+Component:    Admin Guide
 Category:     feature requests
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  macgirvin
 Updated by:   webchick
 Status:       active

Moving to documentation project... for possible inclusion in theme
snippets?




webchick



Previous comments:
------------------------------------------------------------------------

Fri, 16 Dec 2005 20:43:48 +0000 : macgirvin

I was quite happy to see that the site footer and associated items were
moved to the block interface in 4.7, and also that we gained the
ability to put PHP into these entities. Yay!


However, this now presents a new issue - now that the footer (etc.) is
a bona-fide block, it is displayed with all the block 'adornments'
(i.e. the block title) for the theme in use. This makes it less than
pretty for something like a simple copyright message in the page
footer. (I'm using pushbutton, which seems to be the only 4.7 theme
that displays a header and footer). So I'd like to open an enhancement
to allow a block configuration item to 'just display the block
contents' without the title and theme wrappers that would normally be
put on a sidebar block. It would also be nice of course if more themes
displayed a header/footer, but I'll save that for another day.


I also couldn't find a project for the pushbutton theme to file this
under, and it's kind of in that grey area between core and theme, so
I'm putting it under the block.module, since it was changes in that
module which exposed the issue. Please feel free to redirect to the
appropriate (?) place...




------------------------------------------------------------------------

Wed, 21 Dec 2005 14:50:11 +0000 : Moxide

Hello,


I'm not a Drupal specialist, but what you are requesting can easily be
done by editing the file "block.tpl.php" of your theme.
Simply delete : <h2 class="title"><?php print $block->subject; ?></h2>
and all block titles will disappear.


If you want to hide the footer title only, replace the line above with:
<?php if($block->region<>'footer') print "<h2
class=\"title\">{$block->subject}</h2>"; ?>




------------------------------------------------------------------------

Thu, 22 Dec 2005 01:41:26 +0000 : macgirvin

Thanks - I finally tracked through it all and was trying to do something
like this from one level upstairs in the theme engine and splitting off
the block template into two branches i.e. footer-block.tpl.php, but
wasn't having much luck.




------------------------------------------------------------------------

Fri, 23 Dec 2005 02:49:36 +0000 : nedjo

If you come up with a good general solution, please post a patch on the
core PHPTemplate themes.




------------------------------------------------------------------------

Sat, 24 Dec 2005 22:49:47 +0000 : svemir

Attachment: http://drupal.org/files/issues/theme_block_region.patch (1.87 KB)

Here is a patch that allows the templating engine to use a different
sub-template for a block based on its region.


theme.inc->theme_blocks() needs to pass the region to theme_block(),
which adds the region to the array it passes to the engine. Engine
optionally uses (for example) footer_block.tpl.php instead of
block.tpl.php (if it exists.) It seems a minor change in the code to
me, but I did not follow the development of the current themeing
system.


Until this or some other such patch is approved, you can always style
footer blocks differently from other blocks. E.g. to hide the block
title in pushbutton footer, add this into the pushbutton's style:


#footer-message .block .title h3 {
  display: none;
}


------------------------------------------------------------------------

Sun, 25 Dec 2005 07:27:50 +0000 : Crell

While I can see a reason to disable block titles in headers and footers,
I can see a reason to disable them in sidebars, too.  However, it should
be selective.


Why not add a "show block title" checkbox to each block's config page? 
If the admin wants a block to have a title, let it.  If not, don't give
it one.  Where it's placed on the page shouldn't make a difference.




------------------------------------------------------------------------

Mon, 26 Dec 2005 06:54:22 +0000 : macgirvin

Crell's suggestion here is actually what I was asking for in the
original bug report (configuration of whether or not to display the
block title or just the block contents for any given block, regardless
of location) - but I don't know that it's easily doable in the 4.7 time
frame. The theme hack is a quick solution for now. 


If we are able to configure whether or not to display the block title,
it gives us a nice clean and simple interface for arbitrary HTML/PHP
snippets that can appear anywhere on the page. I've seen several issues
requesting this ability. It's so close, but not quite there. Think of it
as poor man's modules. The currently mandatory title display seems to be
the only thing standing in the way of blowing this opportunity wide
open.




------------------------------------------------------------------------

Tue, 27 Dec 2005 13:09:43 +0000 : svemir

Please ignore the patch I submitted previously. It is totally useless.
Blocks already "know" their region, so it is possible to have all the
logic you need in the template itself, as demonstrated in one of the
comments above. Even if some configuration option for blocks is added
in the future, the logic which will check the value of that option will
be in the template itself, just as it is demostrated above. Just,
instead of checking the region it will check something else.






More information about the documentation mailing list