Forums / Templates, Stylesheets, Page Layout / single language button switches but stays on same page

single language button switches but stays on same page

Locked

Views: 1,526

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
23 Sep 2006, 3:01 AM
#1
mylibros_com avatar

mylibros_com

New Zenner

Join Date:
Aug 2006
Posts:
37
Plugin Contributions:
0

single language button switches but stays on same page

I am running a store that has two languages, english and spanish. I have a single button that is supposed to switch everything from one language to the other. I need it to stay on the same page when it switches. Can anyone help a brother out? I am good enough with PHP to be dangerous, but that is about all. You can view what I have set up at https://www.mylibros.com.

23 Sep 2006, 4:56 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: single language button switches but stays on same page

the code attached to your link is this

http://www.mylibros.com/index.php?main_page=index&language=en
```and specifies "main_page", and is why your are taken to this page and not left where ever you might switch from.  Now I am not a php coder but there must be a statement that will take a wild card to allow the current page as the variable.

Zen-Venom Get Bitten

23 Sep 2006, 2:47 PM
#3
mylibros_com avatar

mylibros_com

New Zenner

Join Date:
Aug 2006
Posts:
37
Plugin Contributions:
0

Re: single language button switches but stays on same page

OK, well here's the thing, I have successfully used a hidden field form to post the language variable and it worked quite well. However, when I use a form, it throws the header images out of whack, the spacing on the images get crazy. I want to simply submit the variable using PHP code, but I don't know what functions to create or what variables exist for me to use to be able to use the same code on every page of my template and override pages that I use.

23 Sep 2006, 9:34 PM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: single language button switches but stays on same page

While you can do what you want...you have added many tables to what is designed to be mostly tableless. This has caused many problems...to check go here and attmpt to validate your page: Validator.

This might & might not correct your initial problem but will assist generally with all cart functions.

Zen-Venom Get Bitten

23 Sep 2006, 11:07 PM
#5
mylibros_com avatar

mylibros_com

New Zenner

Join Date:
Aug 2006
Posts:
37
Plugin Contributions:
0

Re: single language button switches but stays on same page

kobra:

This has caused many problems...

I haven't seen any problems arise as a result of the tables I have added... What possible problems can arise or do you see on my site? If there are any serious problems, I definitely want to get them fixed. Please let me know what issues should be addressed.

23 Sep 2006, 11:47 PM
#6
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: single language button switches but stays on same page

did you use the page validator link that I provided?

Zen-Venom Get Bitten

23 Sep 2006, 11:49 PM
#7
mylibros_com avatar

mylibros_com

New Zenner

Join Date:
Aug 2006
Posts:
37
Plugin Contributions:
0

Re: single language button switches but stays on same page

I did. I checked it. What is the importance of W3C validation?

24 Sep 2006, 12:07 AM
#8
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: single language button switches but stays on same page

Mostly cross browser compatibility as each browser will handle these errors in a different manner and with 100 or so this can be a real problem

Zen-Venom Get Bitten

24 Sep 2006, 3:44 AM
#9
seethrou avatar

seethrou

Totally Zenned

Join Date:
May 2004
Location:
Hong Kong
Posts:
1,156
Plugin Contributions:
0

Re: single language button switches but stays on same page

In my view, for not a web pro and only based on other experiences.
It is the basic routine work in technical and called problems isolation.

Validation may not important and although pass the validation not mean problems can be solved.
However, it is not only for semantic and it also help to reduce human faults and
isolate all un-related issues which may cause un-predictable effects to the problems which under being solve.

For your issue, for the variable related to language,

you can view the file and codes below:
includes/classes/language.php
at about line no. 76 - 83

    while (!$languages->EOF) {
      $this->catalog_languages[$languages->fields['code']] = array('id' => $languages->fields['languages_id'],
      'name' => $languages->fields['name'],
      'image' => $languages->fields['image'],
      'code' => $languages->fields['code'],
      'directory' => $languages->fields['directory']);
      $languages->MoveNext();
    }

Where:
(values related to the setting in the admin)
id = the assigned id number of the languages
name = the name of the languages, e.g. English
image = the image file name of the languages, e.g. icon.gif
code = the code ot the languages, e.g. en for english
directory = the located directory of the languages

And called by the languages sidebox template file.
Of which will point to the correct pages of languages selected.
And you can modidy it for your purpose.

includes/templates/template_default/sideboxes/tpl_languages.php

    $content .= '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('language', 'currency')) . 'language=' . $key, $request_type) . '">' . zen_image(DIR_WS_LANGUAGES .  $value['directory'] . '/images/' . $value['image'], $value['name']) . '</a>  ';

A New Starter again