Forums
This topic is locked
Server Variable Refresh
Posted 23 Mar 2004 16:30:37
1
has voted
23 Mar 2004 16:30:37 Matt Jukes posted:
Hi All,Okay, This is a simple question with I believe no answer. I have a site that can be changed into three different languages. These languages are dynamic and are governed by xml pages. All the pages work perfectly with the server variable PATH_INFO adding lang=(en)(de)(es) etc on the end into the querystring as you would expect. However The buttons that enable this Language change are only in one file which is included in all other pages to make changes easier and faster. This means that these language changes must be made as flexible as possible to be implemented on any page.
I have a search on this site and the problem is the results page. When you search and the results page is displayed, then you want to change languages the results are cleared the language is changed and then the all results are displayed. This means that if at first after the search you see 5 results and only 5, once the language is changed you will see every result in the database. This makes for an un-userfriendly interface. I have tried variously different variables but the only one that seems to change the language efficiently is the PATH_INFO.
I am sorry if I haven't explained myself well, Any Ideas Anyone may have would be greatly appreciated.
Matt
Replies
Replied 24 Mar 2004 02:40:31
24 Mar 2004 02:40:31 Phil Shevlin replied:
Have you thought about creating a session variable to hold the language? It seems that it would be a one-time choice that would need to be "held" for the entire session. A perfect use for a session var.
Replied 24 Mar 2004 10:38:47
24 Mar 2004 10:38:47 Matt Jukes replied:
Hi glide,
Yes, I have a session set up to default to en when a user first visits the site. However this is not my problem that feature works perfectly.
Its the results/details pages that are causing difficultly. If you try to change the language on the detail page it comes up with a BOF/EOF failure, and the results page clears any search you may have conducted and displays all possible records from the Database.
Matt
Yes, I have a session set up to default to en when a user first visits the site. However this is not my problem that feature works perfectly.
Its the results/details pages that are causing difficultly. If you try to change the language on the detail page it comes up with a BOF/EOF failure, and the results page clears any search you may have conducted and displays all possible records from the Database.
Matt
Replied 24 Mar 2004 13:56:47
24 Mar 2004 13:56:47 Phil Shevlin replied:
I think you're saying that your search variables (filters) are being lost if they change languages in the middle of a search. But, if I understand your original post you are adding lang=de to the url via a querystring to deal with the language.
It sounds like you're using request.querystring and/or request.form for both sets of vars -- which only carry from one page to the next.
?lang=en should NOT be in the url -- is it?
It sounds like you're using request.querystring and/or request.form for both sets of vars -- which only carry from one page to the next.
?lang=en should NOT be in the url -- is it?
Replied 24 Mar 2004 16:49:17
24 Mar 2004 16:49:17 Matt Jukes replied:
Hi,
Yes ?lang=... is in the querystring eg
when search is conducted querystring looks something like this,
www.mysite.com/results.asp?Type=&Area=&......
when a language change is made the querystring looks like this,
www.mysite.com/results.asp?lang=en
my recordset uses request("var" not .Form or .Querystring to select the results.
I have tried hidden fields and then changing the change language part to something like;
request.servervariable("PATH_INFO"?<%=Request.Form("Form1"%>&.....&lang=en
I know I am close to the solution but just can't get it exactly right
Matt
Yes ?lang=... is in the querystring eg
when search is conducted querystring looks something like this,
www.mysite.com/results.asp?Type=&Area=&......
when a language change is made the querystring looks like this,
www.mysite.com/results.asp?lang=en
my recordset uses request("var" not .Form or .Querystring to select the results.
I have tried hidden fields and then changing the change language part to something like;
request.servervariable("PATH_INFO"?<%=Request.Form("Form1"%>&.....&lang=en
I know I am close to the solution but just can't get it exactly right
Matt
Replied 25 Mar 2004 02:37:38
25 Mar 2004 02:37:38 Phil Shevlin replied:
For your search results and product detail pages, use Request.Querysting("var" instead. Request by itself searches querystring, form, session, etc. To much of a change of var collisions and its more processor intensive (less efficient).
Also, I still do not understand why the language vars are ending up in the quesrystring? You're better off passing them to the session object using form variables.
Also, I still do not understand why the language vars are ending up in the quesrystring? You're better off passing them to the session object using form variables.
Replied 25 Mar 2004 15:33:28
25 Mar 2004 15:33:28 Matt Jukes replied:
Hi,
Yes, I understand what you mean about the lang var being in the querystring. I have a Session variable active as soon as the site is opened. However I can not change the session variable during an onClick event without adding the lang var. I have tried setting the session variable i am using but this doesn't seem to work, Something like <% session("strLanguage" = "en" %>
I apologise for my inexperience, I guess I have bitten off more than I can chew this time <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle> Or maybe I'm just trying to do something I can't.
Yes, I understand what you mean about the lang var being in the querystring. I have a Session variable active as soon as the site is opened. However I can not change the session variable during an onClick event without adding the lang var. I have tried setting the session variable i am using but this doesn't seem to work, Something like <% session("strLanguage" = "en" %>
I apologise for my inexperience, I guess I have bitten off more than I can chew this time <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle> Or maybe I'm just trying to do something I can't.