Drupal messages

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


14 points

Hi All,

I am new to drupal programming. What is the drupal php varaible that shows messages/alerts on the drupal theme?



-5 points

Use drupal_set_messages() in your page.tpl.php in your drupal theme.

<?php
    drupal_set_message
($message NULL$type 'status'$repeat TRUE)
?>

This sets a message which reflects the status of the performed operation.

If the function is called with no arguments, this function returns all set messages without clearing them.

$message The message should begin with a capital letter and always ends with a period '.'.

$type The type of the message. One of the following values are possible:

* 'status'
* 'warning'
* 'error'

$repeat If this is FALSE and the message is already set, then the message won't be repeated.

Anonymous's picture
Created by Anonymous
8 points

These messages can be shown in nice popus using popup api module. They can also be themed to look like stackoverflow.com popups.

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 <% ... %>.