I have custom block template built based on Drupal 7 examples, but it always returns empty content for me:

<div class="caption-text clearfix">
<?= $block->title; ?>
<div class="regular-text clearfix">
<?= $block->content; ?>

Though when I call it from my page.tpl.php it works well:

$block = block_load('block', '1');
    $output =     drupal_render(_block_get_renderable_array(_block_render_blocks(array($block))));
    print $output;

I just need to control where I output the title and content, having my own HTML layout for them.

Please assist.


closed as off-topic by Anil Sagar, kiamlaluno May 25 '14 at 10:08

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on programming, PHP, SQL, etc. that do not relate directly to Drupal are off-topic here, but can be asked on Stack Overflow." – kiamlaluno
If this question can be reworded to fit the rules in the help center, please edit the question.


Avoid short tags as not all servers support them.


<?php print $block->content; ?>

Instead of:

<?= $block->content; ?>

Also in block.tpl.php I would expect to see <?php print $content; ?> instead of $block->content.

  • Thanks but that's not an answer. That's my server and I definitely enabled support for short tags, besides, I tried with <?php print, as well <?= $block->title; ?> works, but not content. – deb0rian Apr 22 '14 at 11:28
  • Comment to your edit: Fun, drupal.org/node/11813 this says something else :/ And.... $content worked. Thanks – deb0rian Apr 22 '14 at 11:34
  • 1
    Drupal coding standards say to always use <?php ?>. Also use $content, not $block->content. – Felix Eve Apr 22 '14 at 11:36
  • 1
    @Fratyr This is an answer - it might not apply to your server setup, but since you haven't declared that, how could we know? – Clive Apr 22 '14 at 12:19

Not the answer you're looking for? Browse other questions tagged or ask your own question.