Customized error messages - possible to do via template or need to mod cpg? Customized error messages - possible to do via template or need to mod cpg?
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Customized error messages - possible to do via template or need to mod cpg?

Started by kubizo, September 08, 2011, 02:10:16 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kubizo

Hi All!

I did some searching, but as a beginner I could not find what I was looking for.

I'd like to customize the messages such as: "Sorry there is no album where you are allowed to upload files".

Is there a way to do this in the template? Or do I need to edit the language files?

I looked for the variable "['err_no_alb_uploadables']" in the theme.php file and it is not there, then I guess it is not possible to do on the template...

Thanks a lot!

(I'm running CPG 1.5.14 at www.kubizo.com/galleries/)

kubizo


ΑndrĂ©

It works this way:
/******************************************************************************
** Section <<<theme_cpg_die>>> - START
******************************************************************************/
// Function for showing error messages
function theme_cpg_die($msg_code, $msg_text, $msg_string, $css_class = 'cpg_message_info', $error_file, $error_line, $output_buffer, $ob)
{
    global $CONFIG, $lang_cpg_die, $template_cpg_die;

    global $lang_upload_php;
    $msg_text = str_replace ($lang_upload_php['err_no_alb_uploadables'], 'Your custom error message', $msg_text);

    $params = array(
            '{MESSAGE}' => $msg_text,
            '{FILE_TXT}' => $lang_cpg_die['file'],
            '{FILE}' => $error_file,
            '{LINE_TXT}' => $lang_cpg_die['line'],
            '{LINE}' => $error_line,
            '{OUTPUT_BUFFER}' => $ob,
            '{HEADER_TXT}' => $msg_string,
            '{CSS_CLASS}' => $css_class,
    );

    if (!($CONFIG['debug_mode'] == 1 || ($CONFIG['debug_mode'] == 2 && GALLERY_ADMIN_MODE))) {
        template_extract_block($template_cpg_die, 'file_line');
    }
    template_extract_block($template_cpg_die, 'output_buffer');

    pageheader($msg_string);
    echo "<!-- cpg_die -->";
    echo template_eval($template_cpg_die, $params);
    pagefooter();
}
/******************************************************************************
** Section <<<theme_cpg_die>>> - END
******************************************************************************/

kubizo