What's wrong hee?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JohnDK

    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.dt d">
    <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=$_SER VER["HTTP_ACCEPT_LA NGUAGE"];
    $userlang=subst r($userlang,0,2 );
    switch($userlan g) {
    // Work so far, but the don't work.
    case 'en': ("location: /en/index.php");bre ak;
    case 'de': ("location: /de/index.php");bre ak;
    default: ("location: /da/index.html");
    }
    ?>
    </body>
    </html>

    BR
    John


  • Kimmo Laine

    #2
    Re: What's wrong hee?

    "JohnDK" <news@jal.aswro te in message
    news:egnkq3$uqg $1@news01.versa tel.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.dt d">
    <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=$_SER VER["HTTP_ACCEPT_LA NGUAGE"];
    $userlang=subst r($userlang,0,2 );
    switch($userlan g) {
    // Work so far, but the don't work.
    case 'en': ("location: /en/index.php");bre ak;
    case 'de': ("location: /de/index.php");bre ak;
    default: ("location: /da/index.html");
    }
    ?>

    1) just writing ("Location :...") does nothing. You propably wanted to call
    header("Locatio n...."); ?
    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@bhg byrzcv.arg)


    Comment

    • JohnDK

      #3
      Re: What's wrong hee?


      "Kimmo Laine" <spam@outolempi .netskrev i en meddelelse
      news:3UIXg.5092 $285.4536@reade r1.news.jippii. net...
      "JohnDK" <news@jal.aswro te in message
      news:egnkq3$uqg $1@news01.versa tel.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.dt d">
      ><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=$_SE RVER["HTTP_ACCEPT_LA NGUAGE"];
      >$userlang=subs tr($userlang,0, 2);
      >switch($userla ng) {
      >// Work so far, but the don't work.
      >case 'en': ("location: /en/index.php");bre ak;
      >case 'de': ("location: /de/index.php");bre ak;
      >default: ("location: /da/index.html");
      >}
      >?>
      >
      >
      1) just writing ("Location :...") does nothing. You propably wanted to
      call header("Locatio n...."); ?
      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@bhg byrzcv.arg)
      Thanks a lot for the help.

      John


      Comment

      • .:[ ikciu ]:.

        #4
        Re: What's wrong hee?

        Hmm JohnDK <news@jal.aswro te:
        // Work so far, but the don't work.
        case 'en': ("location: /en/index.php");bre ak;
        case 'de': ("location: /de/index.php");bre ak;
        default: ("location: /da/index.html");
        header('Locatio n: ........');
        and use ob_* function for this code


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

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


        Comment

        • Jerry Stuckle

          #5
          Re: What's wrong hee?

          ..:[ ikciu ]:. wrote:
          Hmm JohnDK <news@jal.aswro te:
          >
          >>// Work so far, but the don't work.
          >>case 'en': ("location: /en/index.php");bre ak;
          >>case 'de': ("location: /de/index.php");bre ak;
          >>default: ("location: /da/index.html");
          >
          >
          header('Locatio n: ........');
          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@attgl obal.net
          =============== ===

          Comment

          • .:[ ikciu ]:.

            #6
            Re: What's wrong hee?

            Hmm Jerry Stuckle <jstucklex@attg lobal.netwrote:
            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();


            Comment

            • MSB

              #7
              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.dt d">
              <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=$_SER VER["HTTP_ACCEPT_LA NGUAGE"];
              $userlang=subst r($userlang,0,2 );
              switch($userlan g) {
              // Work so far, but the don't work.
              case 'en': ("location: /en/index.php");bre ak;
              case 'de': ("location: /de/index.php");bre ak;
              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?

              Comment

              • Koncept

                #8
                Re: What's wrong hee?

                In article <453D3915.50203 06@asjflasjk.co m>, MSB <asldfh@asjflas jk.com>
                wrote:
                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
                <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=$_SER VER["HTTP_ACCEPT_LA NGUAGE"];
                $userlang=subst r($userlang,0,2 );
                switch($userlan g) {
                // Work so far, but the don't work.
                case 'en': ("location: /en/index.php");bre ak;
                case 'de': ("location: /de/index.php");bre ak;
                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("Locatio n: /path");

                <?php
                $lang = substr($_SERVER["HTTP_ACCEPT_LA NGUAGE"],0,2);
                $mapped = array('en','de' ,'da');
                if(in_array($la ng,$mapped)){
                header("Locatio n: /$lang/index.php");
                exit;
                }
                // default case
                header("Locatio n: /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

                Comment

                Working...