forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: Cyclist on November 25, 2005, 10:12:21 am

Title: headers, footers & language
Post by: Cyclist on November 25, 2005, 10:12:21 am
I have a multilingual site so I need to use different headers according to the choosen language. Is there a way that different headers are included according to the choosen language or - alternatively - is it possible to have different default templates according to the language?
Title: Re: headers, footers & language
Post by: artistsinhawaii on November 25, 2005, 10:41:09 am
Cyclist,

http://forum.coppermine-gallery.net/index.php?topic=8320.msg36862#msg36862

The same principle applied here should be easily ported to the various files you intend to use in 1.4x.


Dennis
Title: Re: headers, footers & language
Post by: Cyclist on November 25, 2005, 05:07:44 pm
Thanks but unfortunately I don't know which file(s) I need to modify and how since I don't know php/mysql very well. Could you give me some more hints?
Title: Re: headers, footers & language
Post by: Nibbler on November 25, 2005, 05:21:54 pm
Decide what you want - different headers or different themes ?
Title: Re: headers, footers & language
Post by: Cyclist on November 26, 2005, 12:00:44 am
different headers - themes was just a thought in case different headers wouldn't work. But I prefer using different headers.
Title: Re: headers, footers & language
Post by: artistsinhawaii on November 26, 2005, 12:10:59 am
different headers - themes was just a thought in case different headers wouldn't work. But I prefer using different headers.

Same principle applies again, Cyclist.
Just use a custom header file, like custom_header.php and use the same code as was pointed out in the link above.

Make sure you include your custom header in the CONFIG menu.

Dennis
Title: Re: headers, footers & language
Post by: Cyclist on November 26, 2005, 01:07:35 pm
Call me stupid but I still don't know how exactly I have to do it and I don't know in which file(s). It might be clear for a coder but not for me. I need to know the files to modify, where to put the changes,... I simply don't know it.
Title: Re: headers, footers & language
Post by: Nibbler on November 26, 2005, 03:35:51 pm
Add a new placeholder for your header in your theme's template.html wherever you want it to appear

Code: [Select]
{LANG_HEADER}
And in your theme's theme.php add or edit the pageheader function

Code: [Select]
function pageheader($section, $meta = '')
{
    global $CONFIG, $THEME_DIR, $USER;
    global $template_header, $lang_charset, $lang_text_dir;

    $custom_header = cpg_get_custom_include($CONFIG['custom_header_path']);

    header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
    user_save_profile();

if ($USER['lang'] == 'german') {
$lang_header = "Herzliche Begrüssung auf Deutsch";
} elseif ($USER['lang'] == 'spanish') {
$lang_header = "Algo en Español";
} else {
$lang_header ="Some greetings in english";
}

    $template_vars = array('{LANG_DIR}' => $lang_text_dir,
        '{TITLE}' => $CONFIG['gallery_name'] . ' - ' . strip_tags(bb_decode($section)),
        '{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'],
        '{META}' => $meta,
        '{GAL_NAME}' => $CONFIG['gallery_name'],
        '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
        '{SYS_MENU}' => theme_main_menu('sys_menu'),
        '{SUB_MENU}' => theme_main_menu('sub_menu'),
        '{ADMIN_MENU}' => theme_admin_mode_menu(),
        '{CUSTOM_HEADER}' => $custom_header,
'{LANG_HEADER}' => $lang_header
        );

    echo template_eval($template_header, $template_vars);
}
Title: Re: headers, footers & language
Post by: Cyclist on November 26, 2005, 04:10:53 pm
Thanks, I will try that. But a short question: Is it also possible to include instead of expressions different php files as header since I want to include menus in different languages which would be probably easiest via external php files.
Title: Re: headers, footers & language
Post by: Nibbler on November 26, 2005, 04:15:13 pm
Yes, how you would do that depends on how you write the php files. If you have them as plain html you can use

$lang_header = file_get_contents("english.php");

If they contain php code that needs to be parsed and have it outputing directly using echo calls then you'd need to use output buffering.