#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Location
    Netherlands
    Posts
    32
    Rep Power
    15
    Hello php-ers,

    My site is in Dutch and English available.
    Nowadays I give links for UK-version something like: "link.html?version=UK".
    (Default is Dutch -> "link.html")

    The problem is a next link they use on the next page falls back in NL-version. Is there a way to store the contents of the version-variable in a environment-like variable? So that a visitor will allways have UK (variable set) or Dutch pages (unset).

    Cheers,

    Richard Vos
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 1999
    Posts
    114
    Rep Power
    16
    Are you using sessions?

    If so, you can use a session variable.

    Alternatively, you can:
    - Store the language in a cookie.
    - Pass the querystring to every page.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    63
    Rep Power
    15
    I generally don't use sessions, I just store everything in the url like so....

    mypage.php3?version=<?echo $version?>

    That way, if the page was opened with a value for version, it will load every link with that url parameter.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Location
    Netherlands
    Posts
    32
    Rep Power
    15
    Well never though of using sessions... I guess spiders like them. -->
    "link.html"

    Ujludwig -
    Using the normal way may give trouble being indexed by search engines --> "link.html?bla=bla"

    Thanks
  8. #5
  9. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,648
    Rep Power
    4493
    If you don't want to use sessions or cookies, then you'll just have to code the original value of $version into every page. Let's say on the first page they click and $version is set to "UK", so on your next page, if you want to link to mypage.html, you'll have to use mypage.html?version=<?php echo $version; ?>, if you have a form, you'll have to include a hidden form element to passs along version. <input type=hidden name=version value="<?php echo $version; ?>">

    sesions or cookies would be easier. it'd also be easy to just have two totally different directories with each version. that way once you choose a version, you're in the right directory and all of the pages in the dir are in the same language.

    ---John Holmes

Similar Threads

  1. Replies: 4
    Last Post: February 13th, 2004, 04:31 PM
  2. A variable $_POST variable?
    By CLuver in forum PHP Development
    Replies: 0
    Last Post: February 11th, 2004, 01:55 AM
  3. How to read multiple line text file into a variable
    By gatewaycityca in forum Visual Basic Programming
    Replies: 4
    Last Post: January 29th, 2004, 01:26 PM
  4. Replies: 5
    Last Post: November 16th, 2003, 12:31 PM
  5. How to grab Javascript form variable into a PHP Variable
    By dfroehli in forum JavaScript Development
    Replies: 3
    Last Post: October 1st, 2003, 09:21 PM

IMN logo majestic logo threadwatch logo seochat tools logo