that will make a link to the page you user is just viewing, only adding '?newlang=SOMETHIG' if there is no query string (no get variables) or '?newlang=SOMETHIG' if there a query string.
/index.php will become /index.php?newlang=en /modules.php?name=News will become /modules.php?name=News&newlang=en Bsantos PHP wrote: >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" <[EMAIL PROTECTED]> wrote in message >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > >>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 >>> >>> >>> >>> >>> >>> >>> >>> > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php