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 ?>
  </section>
</section>

Reference:
https://www.drupal.org/node/1515344

Please follow and like us:
0

Leave a Reply

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

July 14, 2014

Posted In: Information Technology

Tags: , ,

Leave a Comment