Re: [PHP] Updating a GET variable
A bit late in the thread. However, IMO, I don't think session is necessary, unless you intend to save it for later use, during that same visit from the user. If it's just a 1 time request, you can just use (example) $_GET['lang']=en,de,fr,... Then just split up individual languages, process the request of each supported language, and place each relevant localization in its own tab panel, div (non js), etc... Hi Tommy, I read this at least 5 times and still don't quite get your meaning, but I'm curious enough to ask: Could you repeat in other words or give a short example? Marc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Updating a GET variable
-Original Message- From: Marc Guay [mailto:marc.g...@gmail.com] Sent: Wednesday, November 17, 2010 6:30 AM To: PHP General Subject: Re: [PHP] Updating a GET variable A bit late in the thread. However, IMO, I don't think session is necessary, unless you intend to save it for later use, during that same visit from the user. If it's just a 1 time request, you can just use (example) $_GET['lang']=en,de,fr,... Then just split up individual languages, process the request of each supported language, and place each relevant localization in its own tab panel, div (non js), etc... Hi Tommy, I read this at least 5 times and still don't quite get your meaning, but I'm curious enough to ask: Could you repeat in other words or give a short example? Marc Marc, Nathan previously mention what if instead of a language specific request, you have request for multiple languages. I don't know if that's part of you web app feature/service or not but you don't need session to process that request unless you need the results for something else. This example based upon that you use URL query parameter to permit the users to change/select the languages. I don't know how your app is designed but you can process it via $_POST also. $languages = $_GET['lang']=en,de,fr; $langArray = explode(',', $languages); // you can use another separator such as - or _ Than you can process for each of the language: foreach ($langArray as $lang) process_request_func ($lang); div id='lang_en'results of process_request_func() for language en/div div id='lang_de'results of process_request_func() for language de/div div id='lang_fr'results of process_request_func() for language fr/div Or if you have jqueryui or something similar, use tabs for each of those html content where each language goes in its own tab. If you need to save the results for later use, then you'll need the session. Regards, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Updating a GET variable
Nathan previously mention what if instead of a language specific request, you have request for multiple languages. I get it now, multiple _simultaneous_ languages. Cheers, Marc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Updating a GET variable
-Original Message- From: Marc Guay [mailto:marc.g...@gmail.com] Sent: Wednesday, November 17, 2010 8:59 AM To: PHP General Subject: Re: [PHP] Updating a GET variable Nathan previously mention what if instead of a language specific request, you have request for multiple languages. I get it now, multiple _simultaneous_ languages. Cheers, Marc Also FYI, if you do support multiple languages, don't depend on entirely on $_SERVER[HTTP_ACCEPT_LANGUAGE]. I know many folks who are fluent in more than 1 languages but clueless on technology, specifically configuring their system and browser on how to read write those languages. As for myself, I don't configure the web browser because of privacy issue ;) Regards, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Updating a GET variable
-Original Message- From: Nathan Rixham [mailto:nrix...@gmail.com] Sent: Thursday, November 11, 2010 8:18 AM To: Marc Guay Cc: Tamara Temple; PHP General Subject: Re: [PHP] Updating a GET variable Marc Guay wrote: So all you need to do, is take a look at $_SERVER['HTTP_ACCEPT_LANGUAGE'] to get a users language preferences. Hi Nathan, Yep, I'm using this var to set the default but I think it's nice to allow the user to override it. Maybe someone using their computer is more comfortable in a different language? So then surely that would be their default language? However, there is of course the case where somebody wants to see both english and german variations of the same page, so probabyl a good use- case after all - session to the rescue! A bit late in the thread. However, IMO, I don't think session is necessary, unless you intend to save it for later use, during that same visit from the user. If it's just a 1 time request, you can just use (example) $_GET['lang']=en,de,fr,... Then just split up individual languages, process the request of each supported language, and place each relevant localization in its own tab panel, div (non js), etc... Regards, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Updating a GET variable
So all you need to do, is take a look at $_SERVER['HTTP_ACCEPT_LANGUAGE'] to get a users language preferences. Hi Nathan, Yep, I'm using this var to set the default but I think it's nice to allow the user to override it. Maybe someone using their computer is more comfortable in a different language? Marc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Updating a GET variable
Marc Guay wrote: So all you need to do, is take a look at $_SERVER['HTTP_ACCEPT_LANGUAGE'] to get a users language preferences. Hi Nathan, Yep, I'm using this var to set the default but I think it's nice to allow the user to override it. Maybe someone using their computer is more comfortable in a different language? So then surely that would be their default language? However, there is of course the case where somebody wants to see both english and german variations of the same page, so probabyl a good use-case after all - session to the rescue! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Updating a GET variable
On Nov 10, 2010, at 8:58 AM, Marc Guay wrote: foreach($_GET as $k = $v) $qs[$k] = URLDecode($v); $qs['lang'] = 'en'; echo 'a href=index.php?'.http_build_query($qa).'Flip/a'; Hi Tamara, Thanks for the tips. Do you see any advantage of this method over using a small POST form besides the styling problems I'll run into trying to make the submit button look like an achor? The main advantage I see is that you're application doesn't have to become bi-modal, with looking for variables on both the query string and in the post data, then deciding which to use. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Updating a GET variable
Tamara Temple wrote: On Nov 10, 2010, at 8:58 AM, Marc Guay wrote: foreach($_GET as $k = $v) $qs[$k] = URLDecode($v); $qs['lang'] = 'en'; echo 'a href=index.php?'.http_build_query($qa).'Flip/a'; Hi Tamara, Thanks for the tips. Do you see any advantage of this method over using a small POST form besides the styling problems I'll run into trying to make the submit button look like an achor? The main advantage I see is that you're application doesn't have to become bi-modal, with looking for variables on both the query string and in the post data, then deciding which to use. All browsers send the Accept-Language header from the users locale settings, like: Accept-Language:en-GB,en-US;q=0.8,en;q=0.6 So all you need to do, is take a look at $_SERVER['HTTP_ACCEPT_LANGUAGE'] to get a users language preferences. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php