make messages appear just once
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.
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@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.
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@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@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.
thanks a lot, I didn't notice about the $repeat parameter On Fri, Nov 13, 2009 at 6:52 PM, Ezra B. Gildesgame <ezra@growingventuresolutions.com> wrote:
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@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@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.
-- *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.
On 2009-11-13, at 12:41 PM, Adam Gregory wrote:
You can check $_SESSION['messages']
Or better yet, to get current messages call drupal_set_message() with no parameters as the variable may not be set if the DB connection has failed. --Andrew
I have a custom type that is made up of various CCK fields and my users are then able to add new nodes of this type to his website. One of the fields is a CCK text options widget. The problem I have is that I do not know how I can set it up, so that the user is able to add new options. Lets take a 2nd hand car dealer as an example. A car node has a "Fuel Type" field, and the dealer has the option of selecting "Diesel" or "Petrol" from a drop down. Now, what happens when he gets in an electric car? The user does not have the skills to edit the node type directly. And I do not want to have to go in every time and add a new Fuel Type option. Of course, the example of fuel type will rarely happen. But what happens when we have a field that he may add to monthly? The Taxonomy_Other module does exactly what I want, except in this case these fields really should be fields, and not categories. So, is there a module that does what Taxonomy_Other does, but to CCK options fields? Thanks robin **************************************************************************************************************************************************************** The content of this email (and any attachment) is confidential. It may also be legally privileged or otherwise protected from disclosure. This email should not be used by anyone who is not an original intended recipient, nor may it be copied or disclosed to anyone who is not an original intended recipient. If you have received this email by mistake please notify us by emailing the sender, and then delete the email and any copies from your system. Liability cannot be accepted for statements made which are clearly the senders own and not made on behalf of Network Rail. Network Rail Infrastructure Limited registered in England and Wales No. 2904587, registered office Kings Place, 90 York Way London N1 9AG ****************************************************************************************************************************************************************
Robin, I think you can find the functionality you desire in the hierarchical-select module. It does a lot more than what you are asking, but also does what you are asking. http://drupal.org/project/hierarchical_select Shai Shai Gluskin http://content2zero.com On Mon, Nov 16, 2009 at 7:04 AM, Clarke Robin < Robin.Clarke@networkrail.co.uk> wrote:
I have a custom type that is made up of various CCK fields and my users are then able to add new nodes of this type to his website. One of the fields is a CCK text options widget. The problem I have is that I do not know how I can set it up, so that the user is able to add new options.
Lets take a 2nd hand car dealer as an example. A car node has a "Fuel Type" field, and the dealer has the option of selecting "Diesel" or "Petrol" from a drop down. Now, what happens when he gets in an electric car? The user does not have the skills to edit the node type directly. And I do not want to have to go in every time and add a new Fuel Type option.
Of course, the example of fuel type will rarely happen. But what happens when we have a field that he may add to monthly?
The Taxonomy_Other module does exactly what I want, except in this case these fields really should be fields, and not categories.
So, is there a module that does what Taxonomy_Other does, but to CCK options fields?
Thanks robin
****************************************************************************************************************************************************************
The content of this email (and any attachment) is confidential. It may also be legally privileged or otherwise protected from disclosure.
This email should not be used by anyone who is not an original intended recipient, nor may it be copied or disclosed to anyone who is not an original intended recipient.
If you have received this email by mistake please notify us by emailing the sender, and then delete the email and any copies from your system.
Liability cannot be accepted for statements made which are clearly the senders own and not made on behalf of Network Rail.
Network Rail Infrastructure Limited registered in England and Wales No. 2904587, registered office Kings Place, 90 York Way London N1 9AG
****************************************************************************************************************************************************************
Lets take a 2nd hand car dealer as an example. A car node has a "Fuel Type" field, and the dealer has the option of selecting "Diesel" or "Petrol" from a drop down. Now, what happens when he gets in an electric Car? The user does not have the skills to edit the node type directly. And I do not want to have to go in every time and add a new Fuel Type option. I'd create a admin settings page for your site in a custom module, allow the user to define values in a text area, one per line as per the CCK field and then create function to return these. Use this function in the allowed values field on the CCK setup. Kind of duplication but lets the user change the values without being overwhelmed by all of the extra CCK widget/field settings. Hope this makes sense.
participants (7)
-
Adam Gregory -
Andrew Berry -
Clarke Robin -
Ezra B. Gildesgame -
Lee Rowlands -
Lluís -
Shai Gluskin