theme_box

5 theme.inc theme_box($title, $content, $region = 'main')
6 theme.inc theme_box($title, $content, $region = 'main')

Return a themed box.

Parameters

$title: The subject of the box.

$content: The content of the box.

$region: The region in which the box is displayed.

Return value

A string containing the box output.

Related topics

3 theme calls to theme_box()

File

includes/theme.inc, line 1491
The theme system, which controls the output of Drupal.

Code

function theme_box($title, $content, $region = 'main') {
  $output = '<h2 class="title">' . $title . '</h2><div>' . $content . '</div>';
  return $output;
}

Comments

Hidden template file in system folder

If you want to override this function in your theme via template.php, be aware that your themed output may be different due to a template file located in the drupal modules/system folder.

For instance, Comments module uses theme_box() to theme the comment form. The output will be wrapped:

<div class="box">
  <h2>Post New Comment</h2>
  <div>
    <---- FORM HERE ---->
  </div>
</div>

Overriding theme_box() in your template.php to change this output will cause the wrapping div to disappear since the box.tpl.php file is bypassed.

Rather than overriding the theme function, you may be better served by overriding the box.tpl.php template file located in the system folder.

Simply copy box.tpl.php from modules/system and place it in your active theme directory. Then make your adjustments.

Read more about this overlooked template file here: http://drupal.org/node/372471

helpful template

i have examined the template you gave at http://drupal.org/node/372471. that one is really very helpful. i've read a similar post at some technology essays i have come across with over the weekend.

per your instructions, i copied the box.tpl.php from modules/system and place it in my active theme directory. afterwards, it was really fun.

thank you for posting this one. thanks for your post!

Login or register to post comments