What's wrong hee?

This is a discussion on What's wrong hee? within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hi friends. I need some help here. I have make this little piece i PHP, all files are where there ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-13-2006
JohnDK
 
Posts: n/a
Default What's wrong hee?

Hi friends.

I need some help here.

I have make this little piece i PHP, all files are where there shall be.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Sporg fordeling</title>
</head>
<body>
<?php
$userlang=$_SERVER["HTTP_ACCEPT_LANGUAGE"];
$userlang=substr($userlang,0,2);
switch($userlang) {
// Work so far, but the don't work.
case 'en': ("location: /en/index.php");break;
case 'de': ("location: /de/index.php");break;
default: ("location: /da/index.html");
}
?>
</body>
</html>

BR
John


Reply With Quote
  #2 (permalink)  
Old 10-13-2006
Kimmo Laine
 
Posts: n/a
Default Re: What's wrong hee?

"JohnDK" <news@jal.as> wrote in message
news:egnkq3$uqg$1@news01.versatel.de...
> Hi friends.
>
> I need some help here.
>
> I have make this little piece i PHP, all files are where there shall be.
>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
> <title>Sporg fordeling</title>
> </head>
> <body>
> <?php
> $userlang=$_SERVER["HTTP_ACCEPT_LANGUAGE"];
> $userlang=substr($userlang,0,2);
> switch($userlang) {
> // Work so far, but the don't work.
> case 'en': ("location: /en/index.php");break;
> case 'de': ("location: /de/index.php");break;
> default: ("location: /da/index.html");
> }
> ?>



1) just writing ("Location :...") does nothing. You propably wanted to call
header("Location...."); ?
2) you're starting output before setting the header, move the <?php ?> part
before you start outputting the html structure, right at the beginning of
the page, otherwise the header won't do anything.

HTH

--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
spam@outolempi.net | rot13(xvzzb@bhgbyrzcv.arg)


Reply With Quote
  #3 (permalink)  
Old 10-13-2006
JohnDK
 
Posts: n/a
Default Re: What's wrong hee?


"Kimmo Laine" <spam@outolempi.net> skrev i en meddelelse
news:3UIXg.5092$285.4536@reader1.news.jippii.net.. .
> "JohnDK" <news@jal.as> wrote in message
> news:egnkq3$uqg$1@news01.versatel.de...
>> Hi friends.
>>
>> I need some help here.
>>
>> I have make this little piece i PHP, all files are where there shall be.
>>
>>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>> <html xmlns="http://www.w3.org/1999/xhtml">
>> <head>
>> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
>> />
>> <title>Sporg fordeling</title>
>> </head>
>> <body>
>> <?php
>> $userlang=$_SERVER["HTTP_ACCEPT_LANGUAGE"];
>> $userlang=substr($userlang,0,2);
>> switch($userlang) {
>> // Work so far, but the don't work.
>> case 'en': ("location: /en/index.php");break;
>> case 'de': ("location: /de/index.php");break;
>> default: ("location: /da/index.html");
>> }
>> ?>

>
>
> 1) just writing ("Location :...") does nothing. You propably wanted to
> call header("Location...."); ?
> 2) you're starting output before setting the header, move the <?php ?>
> part before you start outputting the html structure, right at the
> beginning of the page, otherwise the header won't do anything.
>
> HTH
>
> --
> "Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
> http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
> spam@outolempi.net | rot13(xvzzb@bhgbyrzcv.arg)


Thanks a lot for the help.

John


Reply With Quote
  #4 (permalink)  
Old 10-13-2006
.:[ ikciu ]:.
 
Posts: n/a
Default Re: What's wrong hee?

Hmm JohnDK <news@jal.as> wrote:
> // Work so far, but the don't work.
> case 'en': ("location: /en/index.php");break;
> case 'de': ("location: /de/index.php");break;
> default: ("location: /da/index.html");


header('Location: ........');
and use ob_* function for this code


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ikciu | gg: 718845 | yahoo: ikciu_irsa | www: www.e-irsa.pl

2be || !2be $this => mysql_query();


Reply With Quote
  #5 (permalink)  
Old 10-13-2006
Jerry Stuckle
 
Posts: n/a
Default Re: What's wrong hee?

..:[ ikciu ]:. wrote:
> Hmm JohnDK <news@jal.as> wrote:
>
>>// Work so far, but the don't work.
>>case 'en': ("location: /en/index.php");break;
>>case 'de': ("location: /de/index.php");break;
>>default: ("location: /da/index.html");

>
>
> header('Location: ........');
> and use ob_* function for this code
>
>


He doesn't need the ob_ functions. In fact, he doesn't need any html at
all.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Reply With Quote
  #6 (permalink)  
Old 10-13-2006
.:[ ikciu ]:.
 
Posts: n/a
Default Re: What's wrong hee?

Hmm Jerry Stuckle <jstucklex@attglobal.net> wrote:
> He doesn't need the ob_ functions. In fact, he doesn't need any html
> at all.



Yes and no :) My solution was written for that code what he showed. You
right he no need html to handle it ofc ...

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ikciu | gg: 718845 | yahoo: ikciu_irsa | www: www.e-irsa.pl

2be || !2be $this => mysql_query();


Reply With Quote
  #7 (permalink)  
Old 10-23-2006
MSB
 
Posts: n/a
Default Re: What's wrong hee?

JohnDK wrote:
> Hi friends.
>
> I need some help here.
>
> I have make this little piece i PHP, all files are where there shall be.
>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
> <title>Sporg fordeling</title>
> </head>
> <body>
> <?php
> $userlang=$_SERVER["HTTP_ACCEPT_LANGUAGE"];
> $userlang=substr($userlang,0,2);
> switch($userlang) {
> // Work so far, but the don't work.
> case 'en': ("location: /en/index.php");break;
> case 'de': ("location: /de/index.php");break;
> default: ("location: /da/index.html");
> }
> ?>
> </body>
> </html>
>
> BR
> John
>
>


what is this for...somone wanting to show a different page based on the
user's lang?
Reply With Quote
  #8 (permalink)  
Old 10-24-2006
Koncept
 
Posts: n/a
Default Re: What's wrong hee?

In article <453D3915.5020306@asjflasjk.com>, MSB <asldfh@asjflasjk.com>
wrote:

> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> > <html xmlns="http://www.w3.org/1999/xhtml">
> > <head>
> > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
> > <title>Sporg fordeling</title>
> > </head>
> > <body>
> > <?php
> > $userlang=$_SERVER["HTTP_ACCEPT_LANGUAGE"];
> > $userlang=substr($userlang,0,2);
> > switch($userlang) {
> > // Work so far, but the don't work.
> > case 'en': ("location: /en/index.php");break;
> > case 'de': ("location: /de/index.php");break;
> > default: ("location: /da/index.html");
> > }
> > ?>
> > </body>
> > </html>
> >
> > BR
> > John
> >
> >

>
> what is this for...somone wanting to show a different page based on the
> user's lang?


Location must be --> header("Location: /path");

<?php
$lang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2);
$mapped = array('en','de','da');
if(in_array($lang,$mapped)){
header("Location: /$lang/index.php");
exit;
}
// default case
header("Location: /your/default/page");
exit;
?>

--
Koncept <<
"The snake that cannot shed its skin perishes. So do the spirits who are
prevented from changing their opinions; they cease to be a spirit." -Nietzsche
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:06 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0