[development] make messages appear just once

Ezra B. Gildesgame ezra at growingventuresolutions.com
Fri Nov 13 17:52:30 UTC 2009


drupal_set_message() has a $repeat parameter.

See http://api.drupal.org/api/function/drupal_set_message/6

Ezra



Ezra Barnett Gildesgame | http://growingventuresolutions.com | http://ezra-g.com



On Fri, Nov 13, 2009 at 12:41 PM, Adam Gregory <arcaneadam at gmail.com> wrote:
> You can check
>
> $_SESSION['messages']
>
> as that's where Drupal stores the messages.
>
> -----
> Adam A. Gregory
> Blog: AdamAGregory.com
> Twitter: twitter.com/adamgregory
> Skype: aagregory2
> Cell: 706.761.7375
>
>
> 2009/11/13 Lluís <enboig at gmail.com>
>>
>> I have some functions which throw info messages like "options saved".
>> Sometimes I call them more than once, sometimes I call some of them;
>> but I want the message appear just once. Where can I store if a
>> message have been saved?
>>
>> Something like:
>> <?php
>>
>> global $once_messages;
>>
>> $message="options saved";
>> if (!$once_messages[$message]) {
>>  once_messages[$message]=TRUE;
>>  drupal_set_message($message);
>> }
>>
>> ?>
>>
>> Any hint?
>>
>> thanks.
>>
>> --
>> *Les normes hi són perquè hi pensis abans de saltar-te-les
>> *La vida és com una taronja, què esperes a exprimir-la?
>> *Si creus que l'educació és cara, prova la ignorància.
>> *La vida és com una moneda, la pots gastar en el que vulguis però
>> només una vegada.
>> *Abans d'imprimir aquest missatge, pensa en el medi ambient.
>
>


More information about the development mailing list