forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Themes/Skins/Templates => Topic started by: azzu5 on January 17, 2006, 08:15:45 am

Title: How to Change theme header image on change of language...?
Post by: azzu5 on January 17, 2006, 08:15:45 am
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
Title: Re: How to Change theme header image on change of language...?
Post by: Joachim Müller 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.
Title: Re: How to Change theme header image on change of language...?
Post by: azzu5 on January 17, 2006, 09:59:37 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
Code: [Select]
{MY_HEADER}
theme.php:
Code: [Select]
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

Code: [Select]

// 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

Code: [Select]

$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
Code: [Select]
$current_language= ?????????;

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

thankx,

Azim

Title: Re: How to Change theme header image on change of language...?
Post by: Joachim Müller on January 17, 2006, 10:13:22 am
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']
Title: Re: How to Change theme header image on change of language...?
Post by: azzu5 on January 17, 2006, 10:32:50 am
i am not getting any value in this $USER['lang']   ???
Title: Re: How to Change theme header image on change of language...?
Post by: Joachim Müller on January 17, 2006, 10:37:41 am
did you make $USER global?
Title: Re: How to Change theme header image on change of language...?
Post by: azzu5 on January 17, 2006, 10:51:01 am
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,
Title: Re: How to Change theme header image on change of language...?
Post by: Joachim Müller on January 17, 2006, 11:02:47 am
try $_GET['lang']
Title: Re: How to Change theme header image on change of language...?
Post by: azzu5 on January 17, 2006, 11:21:14 am
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..?
Title: Re: How to Change theme header image on change of language...?
Post by: Joachim Müller on January 18, 2006, 12:53:20 am
where is the languge is stored..? in the cookies..?
yes
Title: Re: How to Change theme header image on change of language...?
Post by: azzu5 on January 18, 2006, 01:53:24 pm
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
Title: Re: How to Change theme header image on change of language...?
Post by: Joachim Müller on January 19, 2006, 04:57:16 pm
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.
Title: Re: How to Change theme header image on change of language...?
Post by: azzu5 on January 20, 2006, 05:18:20 pm
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  :-*