Re: $_SESSION for language settings?!
| From: | Bsantos PHP | Date: | Mon, 14 Oct 2002 16:21:36 +0000 |
| Subject: | Re: $_SESSION for language settings?! | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-119920@lists.php.net to get a copy of this message | ||
Not realy understanding this:
> then, somewhere on the page, add language links
> $_SERVER['PHP_SELF'] . $_SERVER['QUERY_STRING'].
> ($_SERVER['QUERY_STRING'] ? '&newlang=sp' : '?newlang=sp')
> $_SERVER['PHP_SELF'] . $_SERVER['QUERY_STRING'].
> ($_SERVER['QUERY_STRING'] ? '&newlang=en' : '?newlang=en')
>
Cheers,
bsantos
"Marek Kilimajer" <kilimajer@webglobe.sk> wrote in message
news:3DAAE72D.1040705@webglobe.sk...
> try something like this:
>
> if($_GET['newlang']) {
> switch($_GET['newlang']){
> case 'spanish':
> $_SESSION['lang'] = "contents_sp.php";
> break;
> case 'english':
> $_SESSION['lang'] = "contents_en.php";
> break;
> } elseif (!isset($_SESSION['lang'])) {
> $_SESSION['lang'] = "contents.php";
> }
>
>
> then, somewhere on the page, add language links
> $_SERVER['PHP_SELF'] . $_SERVER['QUERY_STRING'].
> ($_SERVER['QUERY_STRING'] ? '&newlang=sp' : '?newlang=sp')
> $_SERVER['PHP_SELF'] . $_SERVER['QUERY_STRING'].
> ($_SERVER['QUERY_STRING'] ? '&newlang=en' : '?newlang=en')
>
>
>
> Bsantos PHP wrote:
>
> >Hi there!
> >
> >This is some kind my experience:
> >
> >Here's the picture. I've made a simple PHP based Website. Now I hould
like
> >to expand it to spanish language.
> >All of the text that appears on the website in divided by categories,
each
> >one of them set as a variable. All this stuff is in a file
(contents.php).
> >For example:
> >
> >TEXT TO BE DISPLAYED AS HEADLINE 1:
> >
> >...is in file contents.php as...
> >
> >$title1 = "Headline 1";
> >
> >OK, I'm trying to set $_SESSION['lang'] as contents_ing.php or
> >contents.es.php, depending of which language user wants to choose.
> >
> >PROBLEM is that when I call $_SESSION['lang'] = "contents_es.php", it
will
> >only be true for the current page. Next pages will use this:
> >
> >if (!isset($_SESSION['lang'])) {
> > $_SESSION['lang'] = "contents.php";
> >}
> >
> >from startup.php that is the file charged with the index.php page of the
> >website (default page).
> >
> >Can anyone tell me what's wrong?
> >
> >Tanks, bsantos
> >
> >
> >
> >
> >
> >
>