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
-
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?
-
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
-
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?
-
Decide what you want - different headers or different themes ?
-
different headers - themes was just a thought in case different headers wouldn't work. But I prefer using different headers.
-
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
-
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.
-
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);
}
-
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.
-
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.