Last updated 12 April 2009. Created on 3 October 2008.
Edited by JohnNoc, stella. Log in to edit this page.

By placing the code below in your theme's page.tpl.php file, it's possible to have Drupal messages appear as modal popups. Just add the following code:

  <?php if ($show_messages && $messages): ?>
  <div id="lightboxAutoModal" style="display: none;" ><?php print $messages; ?></div>
  <?php endif; ?>

You can control the size of the lightbox window, either via the configuration form at admin/settings/lightbox2/html_content - this is a global property which will affect the default size of all modal windows, or by adding a rel attribute like:

<div id="lightboxAutoModal" rel="lightmodal[|height: 50px;]" style="display: none;" ><?php print $messages; ?></div>

You could expand on this to show other types of information that is available in the theme layer too.

Looking for support? Visit the forums, or join #drupal-support in IRC.


Max_Headroom’s picture

There is a module that do this nicely: Better messages

Quentin Campbell

Harry Slaughter’s picture

lightboxAutoModal does not seem to work with the d6 version

Devbee -

bdimofte’s picture

"lightboxAutoModal" works fine with ligthbox2 on D6 (6.x-1.11)