dolibarr-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Dolibarr-dev] How to display error message using jnotify


From: Régis Houssin
Subject: Re: [Dolibarr-dev] How to display error message using jnotify
Date: Fri, 09 Nov 2012 07:51:46 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20121026 Thunderbird/16.0.2

hi,

since version 3.3, it is no longer necessary to use these functions. you can replace:

$mesg = "<div class='error'>". $langs->trans('xxx')."</ div>";

......

dol_htmloutput_errors ($mesg);

by just :

setSeventMessage($langs->trans('xxx'), 'errors'); // for error

or
setSeventMessage
($langs->trans('xxx')); // for ok
or

setSeventMessage($langs->trans('xxx'), 'warnings'); // for warning


This function loads the messages,
and function llxFooter() will be responsible for displaying messages.


by cons in classes, you must return your messages always like this:

$this->error = $ langs->trans('xxx');
or
$this->error = 'xxx'; (the function setSeventMessage() will handle the translation.
)




Le 09/11/12 06:28, Florian Henry a écrit :
Hello Marc Henri,

   The common functions to call for this is located in core/lib/function.lib.php

/**
 *  Print formated error messages to output (Used to show messages on html output).
 *
 *  @param    string    $mesgstring          Error message
 *  @param  array    $mesgarray           Error messages array
 *  @param  int        $keepembedded        Set to 1 in error message must be kept embedded into its html place (this disable jnotify)
 *  @return    void
 *
 *  @see    dol_print_error
 *  @see    dol_htmloutput_mesg
 */
function dol_htmloutput_errors($mesgstring='', $mesgarray='', $keepembedded=0)

or

/**
 *    Print formated messages to output (Used to show messages on html output).
 *
 *    @param    string    $mesgstring         Message
 *    @param    array    $mesgarray       Messages array
 *  @param  string    $style           Which style to use ('ok', 'warning', 'error')
 *  @param  int        $keepembedded    Set to 1 if message must be kept embedded into its html place (this disable jnotify)
 *  @return    void
 *
 *  @see    dol_print_error
 *  @see    dol_htmloutput_errors
 */
function dol_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepembedded=0)




    Put it after the llxHeader() in your php page like :

llxHeader();
     
print_titre('toto');

if ($error) {
    dol_htmloutput_errors('',$mesg_err,1);
}



Kind regards


Florian HENRY
address@hidden
+33 6 03 76 48 07
http://www.open-concept.pro

Le 09/11/2012 03:07, Marc-Henri Pamiseux a écrit :
Hi,

In some case, i can see an error message on the top of the page, in a
red/pink box. This box is an html <div> using the CSS class
"jnotify-message". Ok, but what is the name of the function that can
display such a message ? I can't find it as easily than i would believe.

Best regards


_______________________________________________
Dolibarr-dev mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/dolibarr-dev



_______________________________________________
Dolibarr-dev mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/dolibarr-dev

Cordialement,
-- 
Régis Houssin
---------------------------------------------------------
Cap-Networks
Cidex 1130
34, route de Gigny
71240 MARNAY
FRANCE
VoIP: +33 1 83 62 40 03
GSM: +33 6 33 02 07 97
Web: http://www.cap-networks.com/
Email: address@hidden

Dolibarr developer: address@hidden
Web Portal: http://www.dolibarr.fr/
SaaS offers: http://www.dolibox.fr/
Shop: http://www.dolistore.com/
Development platform: https://doliforge.org/
---------------------------------------------------------

reply via email to

[Prev in Thread] Current Thread [Next in Thread]