Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: headers, footers & language  (Read 12067 times)

0 Members and 1 Guest are viewing this topic.

Cyclist

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 42
headers, footers & language
« 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?
Logged

artistsinhawaii

  • VIP
  • Coppermine addict
  • ***
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 856
    • evj art and photography
Re: headers, footers & language
« Reply #1 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
« Last Edit: November 25, 2005, 05:31:27 pm by GauGau »
Logged
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

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 42
Re: headers, footers & language
« Reply #2 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?
Logged

Nibbler

  • Guest
Re: headers, footers & language
« Reply #3 on: November 25, 2005, 05:21:54 pm »

Decide what you want - different headers or different themes ?
Logged

Cyclist

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 42
Re: headers, footers & language
« Reply #4 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.
Logged

artistsinhawaii

  • VIP
  • Coppermine addict
  • ***
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 856
    • evj art and photography
Re: headers, footers & language
« Reply #5 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
Logged
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

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 42
Re: headers, footers & language
« Reply #6 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.
Logged

Nibbler

  • Guest
Re: headers, footers & language
« Reply #7 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);
}
Logged

Cyclist

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 42
Re: headers, footers & language
« Reply #8 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.
Logged

Nibbler

  • Guest
Re: headers, footers & language
« Reply #9 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.
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 20 queries.