i d like not to show the title of my various blocks.
i tried to do it with css but i couldn't get something working properly.

any idea would be great.

Tom

Comments

squaretone’s picture

I use phptemplate so i employ a bit of php to trim the titles out. There may be a more elegant or efficient solution but this worked for me in a pinch:

<?php

// remove h2 tags and output content
$sidebar_rightNoTitle = preg_replace("/<h2>(.*)<\/h2>/", "", $sidebar_right);
print $sidebar_rightNoTitle;
?>

Eric Lawrence
Developer/UX Designer
http://squaretone.com

tomdeb’s picture

Sorry i m fairly new to drupal but so where do you put that code in phptemplate?

knowing that i don't use phptemplate, will I have to rewrite my whole theme ?

thanks

t o m

squaretone’s picture

The css method listed below by gpdinoz is probably the easiest way but make sure you test it accross a range of browsers. Some browsers will, even though it is 'collapsed', give the collapsed value a height anyway and possibly create an unwanted gap.

You will not need to install phptemplate if you just use the css method.

I don't know if there is an easier way to do it using xtemplate.

FYI, drupal 4.7 comes with phptemplate installed as the default template engine as opposed to 4.6 and below which has xtemplate installed by default. So learning and using phptemplate is the proverbial 'wave of the future'

Eric Lawrence
Developer/UX Designer
http://squaretone.com

tomdeb’s picture

evenrthough i will try the css method, i think i ll go for migrating my theme to phptemplate.
looking at the doc, it can't take too long.

squaretone’s picture

I'm pretty comfortable with php so I pretty much went straight to phptemplate anyway. it just makes more sense in my head than the other templating system.

Keep reading the documentation on it. There's probably a better way to do it than the way I mentioned.

Eric Lawrence
Developer/UX Designer
http://squaretone.com

behindthepage’s picture

Try this

.block h2 {
visibility: collapse ;
display: none; }

gpdinoz
"If we can see further it is because we stand on the shoulders of giants"

Regards
Geoff

squaretone’s picture

I was searching and replacing characters with php to remove the block titles in the example I posted above. Since then, I've learned more about phpTemplate and how it works. It is pretty groovey. You just copy block.tpl.php from /themes/engines/phptemplate/ (the default display of a block) to your theme directory and edit as appropriate. It is pretty simple once you open it up.

Here's the link from the theme developers guide. I orignonally had trouble finding it:
http://drupal.org/node/11813

Eric Lawrence
Developer/UX Designer
http://squaretone.com

januario’s picture

Here's a great hack to do this only with selected blocks in phpTemplate.

sameth33’s picture

I know this post is old but I figure it might be helpful to someone else.

For Drupal 7:
path: admin/structure/block
pick your block, click configure
in the title you'll the following: Override the default title for the block. Use to display no title, or leave blank to use the default block title.

This option allows you to hide title per block without going into CSS or Drupal tpl files.

- Sam