Undefined Variable: title

Notice: Undefined variable: title in include() (line…..

I came across the aforementioned issue while developing a custom Drupal template from scratch; I will post a link to the final work later on.

The consequence was that the block’s title was not displayed even if the title has been set in the admin panel. This issue normally arises from block.tpl.php and can be solved by using the following Drupal HTML5-based code (original Drupal block template code):

<section id="<?php print $block_html_id; ?>" class="<?php print $classes; ?>"<?php print $attributes; ?>>
  <?php print render($title_prefix); ?>
  <?php if ($block->subject): ?>
    <h2<?php print $title_attributes; ?>><?php print $block->subject ?></h2>
  <?php endif;?>
  <?php print render($title_suffix); ?>
  <section class="content"<?php print $content_attributes; ?>>
    <?php print $content ?>


July 14, 2014

Posted In: Information Technology

Tags: , ,

Leave a Comment