How to display messages from a block separately from $messages in page.tpl.php I have a webform which works as a newsletter subscription form: it displays a textfield for an email and a button. When the button is clicked, a notification message is displayed on top of the page where any other messages are usually displayed.

However because the webform is a block and it's displayed in the sidebar, it would be more usable if the message is displayed right above the block, where visitor's focus currently is, instead of top-middle of the page. Is this something possible to implement?

To generalise: is it possible to display messages from different blocks/modules in different sections of the page instead of the unified $messages variable?
If the notification is being set in the $messages variable used in page.tpl.php you can emulate theme_status_messages() by adding this to your theme's template.php file

function YOURTHEME_preprocess_block(&amp;$vars) {

  $block = $vars['block'];

  if ($block-&gt;module == 'MODULENAME' &amp;&amp; $block-&gt;delta == 'DELTA') {
  $output = '';
  foreach (drupal_get_messages(NULL, FALSE) as $type =&gt; $messages) {
    $output .= "&lt;div class=\"messages $type\"&gt;\n";
    if (count($messages) &gt; 1) {
      $output .= " &lt;ul&gt;\n";
      foreach ($messages as $message) {
        $output .= '  &lt;li&gt;' . $message . "&lt;/li&gt;\n";
      }
      $output .= " &lt;/ul&gt;\n";
    }
    else {
      $output .= $messages[0];
    }
    $output .= "&lt;/div&gt;\n";
  }

  $vars['messages'] = $output;
  }
}


Then in the template file for just your block (e.g. block-MODULENAME-DELTA.tpl.php), print the $messages variable.