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

Submitted by programmer on Mon, 10/27/2008 - 14:37.
::

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>

-1 points

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

Created by Anonymous

Post your Answer

  • Lines and paragraphs break automatically.
  • 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 <% ... %>.
  • Links to specified hosts will have a rel="nofollow" added to them.

More information about formatting options