How to Change theme header image on change of language...? How to Change theme header image on change of language...?
 

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]

Main Menu

How to Change theme header image on change of language...?

Started by azzu5, January 17, 2006, 08:15:45 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

azzu5

Hi All,

Iam using 1.3.5 version..

I am using 2 languages for my gallery Englsih and Arabic... Now i want to change the theme header image according to language..!

B'coz i have different header images for Arabic & English..

Please help me i how i can change those images.. ???

Thanx

Azim

Joachim Müller


azzu5

Quote from: GauGau on January 17, 2006, 09:09:31 AM
you'll have to create a custom header, see http://forum.coppermine-gallery.net/index.php?topic=9863.msg44419#msg44419 and various other threads that explain this.

Hi,
I have already changed gallery theme header and footer to my website theme..

But my question is i have 2 images "ar-header.jpg" and "en-header.jpg" and default language is english so i m showing "en-header.jpg" and when i 'll select labgauge as Arabic i want to show "ar-header.jpg"

As in the url i m not always getting "lang=English or Arabaic" variable so i could use it show the proper images..!

I tried to solve this way but it dont knwo that much...help me.

template.html: Inserted this code on the page top
{MY_HEADER}

theme.php:

function pageheader($section, $meta = '')
{
    global $CONFIG, $THEME_DIR;
    global $template_header, $lang_charset, $lang_text_dir;

    $charset = ($CONFIG['charset'] == 'language file') ? $lang_charset : $CONFIG['charset'];

    header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
    header("Content-Type: text/html; charset=$charset");
    user_save_profile();


Now i want some code here to know what is my current langauge......something like this



// Store current languge in this variable
$current_language= ????????????;

if ($current_language=="English")
{
       //Set Arabic Header
       $my_header_img = "ar_header.jpg";
}
else
{
       //Set English Header
      $my_header_img = "en_header.jpg";
}



Now i can send this filename to template.htm



$template_vars = array('{LANG_DIR}' => $lang_text_dir,
        '{TITLE}' => $CONFIG['gallery_name'] . ' - ' . $section,
        '{CHARSET}' => $charset,
        '{META}' => $meta,
        '{GAL_NAME}' => $CONFIG['gallery_name'],
'{MY_HEADER}' => $my_header_img,
        '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
        '{MAIN_MENU}' => theme_main_menu(),
        '{ADMIN_MENU}' => theme_admin_mode_menu(),
        );

    echo template_eval($template_header, $template_vars);
}


Now here i want only one value somehaw

$current_language= ?????????;


I dont know whether i m right or not but pls tell me how to solve this..

thankx,

Azim


Joachim Müller

you'll have to do as I suggested and then add an if/then switch that checks the user's selected language. Check for $USER['lang']

azzu5


Joachim Müller


azzu5

Ok now i got the value

But still there is something wrong..

Now when i changed language from Dropdown selection..... in $USER['lang'] only "english" value is showing not arabic or any other.

Ho wi'll know current language after changing from dropdown list..

Regards,

Joachim Müller


azzu5

Geting only once after selecting from dropdown

/gallery/thumbnails.php?album=lastcom&cat=0&lang=english

but when i go to another page

/gallery/thumbnails.php?album=lastup&cat=0

"lang=" is not there in the url...!

where is the languge is stored..? in the cookies..?

Joachim Müller


azzu5

I checked the cookies also..but i think that is also encrypted..cant acces that..! :(

is there any way to solve my problem..pls

thankx

Joachim Müller

I don't have the coppermine source code available at the computer I'm typing this reply at. I suggest you review the vars and constants defined in include/init.inc.php, there should be one that holds the language. Maybe you'll need to add another if/then switch that checks if the user has chosen a custom language and fallback to the default language if he hasn't.

azzu5

Hi GauGau,

Finally my problem is Solved  :)

$USER['lang'] is saving changed language name...

I was getting this value only once..so when i got this value i saved it to the own cookies and then retrived it in theme.php and sent it to template.php and it works fine...

Thanx for your all support and such beatiful gallery..

Cheers  :-*