hi
i am wondering if it is possible for blocks not to display their title. ( i have a bunch of custom ones and I would rather have an image with text)...
so where do i turn that off ?
i tried renaming them all to "" but this seems to create duplication issues in the database...

help would be appreciated!!!

- jochen

Comments

lennart’s picture

In your theme's style.css you can set the title of the blocks not to display

eg.

#sidebar-left .title {
display: none;
}

Best regards,
Lennart

Best regards,
Lennart

bhagman’s picture

Just name them something like:

<!-- MyBlock -->

I'm not sure though. I read this somewhere in the forums. Can't find the post though. I know it works for menus.

zach harkey’s picture

Although there are several workarounds for keeping titles from displaying in blocks, I don't understand why there isn't a check box to toggle the stankin thing on or off.

This has got to be one of the most frequently asked questions on this site, and it seems that it could be addressed with a simple check box in the admin form...

[x] Hide title
If checked, the title will not be displayed in the block.

The CSS trick works, but unless you want all box titles hidden, and not just some, you have to go view the source and find out what the id of your block is so you can put a css rule for that one box, and even them you really only hide it for css capable browsers, it's still there.

Blocks by nature are supposed to serve a wide variety of purposes and the pervasive title issue seems to try to force them all to be the same kind of thing.

I probably wouldn't care but I have way too many display: none rules clogging up my css sheet when they shouldn't. CSS is to control presentation, and this is an issue of content. I don't want a title because I don't want it in my content, not because I want it there but I don't want anyone to see it.

-zach
------------------------
harkey design

: z

jochenh’s picture

sorry, i am not that good at css. so i have tried adding all kinds of permutations on the css fix but it's not working. here is the source of the page:

<div class="block block-forum" id="block-forum-0">
<h2>Active forum topics</h2>
<div class="content">
... some content ...
</div><div class="more-link">
<a href="/?q=forum" title="Read the latest forum topics.">more</a></div>
</div>

so what should my css statment be to turn the h2 element off...?

thanks so much for the help!
- jochen

zach harkey’s picture

#block-forum-0 h2 { display: none; }

-zach
------------------------
harkey design

: z

jochenh’s picture

thanks that worked!

ArunK’s picture

Is there anyway to have 2 blocks with the same name?

I have a site where I want to have a "Sponsored Links" tower from Gogole both on the left and right on some pages. For now, I just hardcoded one into the template itself.

sepeck’s picture

Make the block description for each block unique. I believe the block name is generated from that. If there is no description, it uses the block title.

-sp
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

ArunK’s picture

I've tried that, but it doesn't work. I'm running 4.6 at the moment.

For #1, in the description, I wrote Sponsored#1.
For #2, in the description, I wrote Sponsored#2.

Then, for the block titles, I tried to name both of them Sponsored Links, but only one of them works.

Also, I tried inserting html code above the adsense code, without a block title but it doesn't look right.

ArunK’s picture

Any other suggestions or options?

lzfranc’s picture

It seems ridiculous my suggestion, but what do you think of to name one block as "Sponsored links" and other block as "More sponsored links"? Sometimes the best way is to be pragmatical.

ArunK’s picture

I thought of doing some little variation of that, but I would like to keep it consistent.

wpd’s picture

Add a comment to the end of the title for the second one:

Sponsored Links 	<!-- #2 -->

Should display as:
Sponsored Links

Scott
White Paper Designs

shane’s picture

Unforutnately 4.6.x (not sure which point release) has broken the use of CSS or HTML code in a title - INCLUDING HTML comment entitites. I used to use this method - then upgraded from 4.6.0 to 4.6.5 (silly me) - which caused all my block titles to become a problem...

Nat-2’s picture

Hi,
We're looking at making the shift from Mambo driven sites, and mostly all is going well...

I am in the same position, wanting some blocks with headers, and some without. Don't really want to have the hack the file every time as its a little un-dynamic and seems like a step backwards. I tried the commenting but ended up with title with

in them.

I tried not entering a title, but the

tags remained and thats not a good look for code validation.

any other answers?

Thanks a lot, I've heard this is a very good community,

Nat
Decisive Flow - How People Choose You

shane’s picture

NAT - the 4.7 allows much better control over the block title now. In 4.7 code, you have the ability to set the "Title" which is what gets displayed - this can be unique, non-unique, or blank as you choose, and also set a unique "Description" which must be unique for each block. Drupal 4.7 code now uses the "Description" to track and manage the block internally - not the actual "Title".

I know 4.7 is beta still, but it might be worth starting to use it if - you have some lag between now and when you want to go live. Only downside, is modules for 4.7 are behind the curve - however a number of them in the CVS repository work with the 4.7beta releases.

4.6 code still doesn't allow much in the way of flexibility in titles. In fact, from 4.6.x (not sure which point release), there has been a significant step back - in that you CAN'T use HTML Comment Entities to make a title unique and disappear all together if you wanted to. That seriously pissed me off... But, I understand it's something to do with preventing Cross Site Scripting or similar potential issues. My opinion is that's just plain silly, since as an Admin I control my block titles - it's not something users have control or access to - barring any bugs in the code.

Good Luck!

gtoddv’s picture

How do you turn block titles on and off in 4.7? I can't find it for the life of me.

Thanks

zach harkey’s picture

In 4.7 you can just leave the "Block title" field blank and no title will be printed.

Personally, I think the description should be appended to point this out.

-zach
------------------------
harkey design

: z

gtoddv’s picture

I have the block titles in the setup of the block but none of them are showing. The block code appears to allow for the block title and I have seen this theme 'Mollio' display them. But I can't find any clue as to why they don't show. I also can't find the Primary and Secondary links, they were there but now they don't show in any theme.

If anyone knows what is going on please, please, please. I am going crazy. Stayed up too late last night trying to figure this out!!!

thanks

BTW - the link you provided throws a 'page not found'.

sepeck’s picture

Perhaps here: http://drupal.org/node/57649
Primary and secondary link behavior changed in 4.7

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

zach harkey’s picture

<?php print $block-subject ?> in your block.tpl.php should print out the "Block title". Make sure to view the source code of the output to your browser. It very well could be there but you have some tricky css rule that's hiding it (e.g. display: none; or text-indent: -9999px are the rules that always get me).

-zach
--
harkey design

: z

Budrick’s picture

asiby’s picture

Hello everybody,

Here is how I have managed hide my titles in drupal 4.6

Basically, I told my template not to show the module title if it contains one or more white spaces at its beginning.

I was using phpTemplate, so I have copied the default file named block.tpl.php from the /themes/engines/phptemplate folder. Then, I have change the file from this :

<div class="<?php print "block block-$block->module" ?>" id="<?php print "block-$block->module-$block->delta"; ?>">
  <h2><?php print $block->subject ?></h2>
  <div class="content"><?php print $block->content ?></div>
</div>

to that :

<?php
  $hide_title = false;
  if (ltrim($block->subject) != $block->subject){
    //Do not show any title if there are some white space at the beginning of the title
    $hide_title = true;
  }
?>
<div class="<?php print "block block-$block->module" ?>" id="<?php print "block-$block->module-$block->delta"; ?>">
  <?php if (!$hide_title) {?><h2><?php print $block->subject ?></h2><?php }  ?>
  <div class="content"><?php print $block->content ?></div>
</div>

Live long ... and prosper!