Advanced search  

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

Pages: [1]   Go Down

Author Topic: Customized error messages - possible to do via template or need to mod cpg?  (Read 2255 times)

0 Members and 1 Guest are viewing this topic.

kubizo

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24

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/)
Logged

kubizo

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
Re: Customized error messages - possible to do via template or need to mod cpg?
« Reply #1 on: September 08, 2011, 03:24:28 pm »

Sorry everyone: CPG 1.5.12, not 14

Thanks!
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764

It works this way:
Code: [Select]
/******************************************************************************
** 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
******************************************************************************/
Logged

kubizo

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
Re: Customized error messages - possible to do via template or need to mod cpg?
« Reply #3 on: September 09, 2011, 02:48:58 pm »

Cool! This is great! Thanks so much!

Logged
Pages: [1]   Go Up
 

Page created in 0.023 seconds with 19 queries.