Drupal: How to show Drupal messages in a Nice Lightbox!!!

This Comment will be submitted for moderation and will not be accessible to other users until it has been approved.


1. Install lightbox2 on drupal

2.

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:

<pre>

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

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:

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

 </pre>

                                     
-5 points

may not work in d6: http://drupal.org/node/783474

Anonymous's picture
Created by Anonymous
2 points

According to http://drupal.org/node/325427
You have to do:

<?php print $messages?>

instead of

<?php print $messages?>
Anonymous's picture
Created by Anonymous

Post Comment

  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.