headers, footers & language headers, footers & language
 

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

headers, footers & language

Started by Cyclist, November 25, 2005, 10:12:21 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Cyclist

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?

artistsinhawaii

#1
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
Learn and live ... In January of 2011, after a botched stent attempt, the doctors told me I needed a multiple bypass surgery or I could die.  I told them I needed new doctors.

Cyclist

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?

Nibbler

Decide what you want - different headers or different themes ?

Cyclist

different headers - themes was just a thought in case different headers wouldn't work. But I prefer using different headers.

artistsinhawaii

Quote from: 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.

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
Learn and live ... In January of 2011, after a botched stent attempt, the doctors told me I needed a multiple bypass surgery or I could die.  I told them I needed new doctors.

Cyclist

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.

Nibbler

Add a new placeholder for your header in your theme's template.html wherever you want it to appear

{LANG_HEADER}

And in your theme's theme.php add or edit the pageheader function


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);
}

Cyclist

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.

Nibbler

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.