Some of the blocks that come built into Drupal are great, but I would like to alter the title of the block displayed to the user. Since I cannot define this in the configure area of each block, is there a location within code that I can modify?

Thanks,
-=Vince

Comments

somes’s picture

usually they appear in the module file like l('Events')
have a play changing them

make a backup just in case

pwolanin’s picture

If you want to do this in a way that is more easily portable, there are two possible approaches that I'm familiar with. Both will let you keep the changes out of the core or module so you don't have to worry about re-making them when you upgrade when a new Drupal or module release comes out. This can save you major headaches down the line.

1) use the locale module as described to substitute your preferred text:
http://drupal.org/node/24593
http://drupal.org/node/35037
http://drupal.org/node/58030

2) try doing this in your block template file. Here's an example for Drupal 4.7 that should work. This is a modification of the standard block.tpl.php that comes with blumarine or other templates for the phptemplate engine. It changes the name of the "Search" block to "Search site".

<?php if($block->module == 'search'): ?>

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

<?php else: ?>

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

<?php endif; ?>

---
Work: BioRAFT

oziumjinx’s picture

Thanks for the tips pwolanin, but I cant seem to find the block.tpl.php file. Im using a modified box_grey theme with Drupal 4.6.6.

Since this is a different theme than bluemarine, is this code within a different file that you know of?

-=Vince

Technology White Papers

sepeck’s picture

http://drupal.org/search/node/block.tpl.php+type%3Abook

http://drupal.org/node/11813
You need to create a block.tpl.php file and it will override the default phptemplate engine behavior
http://drupal.org/phptemplate

-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

pwolanin’s picture

The box_grey theme doesn't include its own- it uses the default file that's in the /engines/phptemplate folder. You can copy this to your theme folder and mess with its. You can also use what I have posted above. The only difference is that the default version doesn't have the <div> shown as <div class="title">.

You might also find some helpful info here: http://drupal.org/node/11813

---
Work: BioRAFT

oziumjinx’s picture

Thanks for the tips...much appreciated

-=Vince

Technology White Papers