SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    ********* Streaker Lister14's Avatar
    Join Date
    Jun 2002
    Location
    C:\Documents and Settings\Desktop\Recycle Bin
    Posts
    677
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    german / french ISSUE

    hi people,

    this is a strange case... up until a few days ago everything was fine, www.trainer.lu was available in 2 languages: german and french...

    now all of a sudden, without me changing anything at all, not even LOOKING at the code (lol) the page doesn't work in german no more...

    any help please, please, pretty please...

    here part of my code:

    "index.php"
    PHP Code:
    <?php
    $thisPage
    ="home";

    $id $HTTP_GET_VARS['id'];

    switch (
    $id) {

        case 
    "fr":
            break;
        case 
    "de":
            break;
    }

    if (
    $id == "de") {
     include(
    "inc/header.inc.php");
     include(
    "inc/de/$thisPage.inc.php");
     include(
    "inc/footer.inc.php");
    }

    else {
     include(
    "inc/header.inc.php");
     include(
    "inc/fr/$thisPage.inc.php");
     include(
    "inc/footer.inc.php");
    }
    ?>
    part of the navigation.inc file

    HTML Code:
     <h3>Personal Trainer&nbsp;&raquo;</h3>
    <ul>
     <li><a <?php if ($thisPage=="coach") { echo " class=\"currentpage\""; }?> href="coach.php<?php
       if ($id == "de") { echo "?id=de";}
        else if ($id == "en") { echo "?id=en";}
         else { echo "?id=fr";} ?>" title="Coach">Coach</a></li>
    roy.lu
    C:\DOS... C:\DOS\RUN... RUN\DOS\RUN...!

  2. #2
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    I would guess your PHP version has been updated.

    Change...
    $id = $HTTP_GET_VARS['id'];

    To...
    $id = $_GET['id'];
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  3. #3
    SitePoint Evangelist
    Join Date
    Jun 2006
    Location
    Wigan, Lancashire. UK
    Posts
    523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is $HTTP_GET_VARS still supported in PHP. I thought it had been completely dropped now, replaced with the $_GET superglobal.
    It may be that PHP has been upgraded on your server

    You should probably also have a default for your language switch statement. In fact, why do you have the switch statement seeing as it does nothing.
    Last edited by Mark Baker; Oct 27, 2009 at 13:35. Reason: Added switch default comment to provide value-added after SilverBulletUK beat me to the response
    ---
    Development Projects:
    PHPExcel
    PHPPowerPoint

  4. #4
    ********* Streaker Lister14's Avatar
    Join Date
    Jun 2002
    Location
    C:\Documents and Settings\Desktop\Recycle Bin
    Posts
    677
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for the $_GET ... haven't kept up to date with the php thing... lol, but seems much easier like that

    the switch statement does nothing?, so the if/else statement is enough in index.php?
    ... what about the rest of the code, i might have a use for it later on

    edited: i am sure there must be a way to be even more efficient, not having to create multiple files i.e. index.php, contact.php etc. ... there must be an if / else for that too... but then i start getting overly confused, and therefore keep some things a part...
    roy.lu
    C:\DOS... C:\DOS\RUN... RUN\DOS\RUN...!

  5. #5
    ********* Streaker Lister14's Avatar
    Join Date
    Jun 2002
    Location
    C:\Documents and Settings\Desktop\Recycle Bin
    Posts
    677
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $thisPage="page_name";

    $id $_GET['id'];

     include(
    "inc/header.inc.php");

    if (
    $id == "de") {
     include(
    "inc/de/$thisPage.inc.php");
    }
     else if (
    $id == "gb"){
      include(
    "inc/gb/$thisPage.inc.php");
     }
      else {
       include(
    "inc/fr/$thisPage.inc.php");
      }

     include(
    "inc/footer.inc.php"); 
    can this be replaced with

    PHP Code:
    $thisPage="page_name";

    $id $_GET['id'];

     include(
    "inc/header.inc.php");

    switch (
    $id) {
        case 
    "fr":
             include(
    "inc/$id/$thisPage.inc.php");
            break;
        case 
    "de":
             include(
    "inc/$id/$thisPage.inc.php");
            break;
        case 
    "gb":
             include(
    "inc/$id/$thisPage.inc.php");
            break;
    }

     include(
    "inc/footer.inc.php"); 
    ? ... or is there a nicer/better/shorter way do do this?
    ... and what would be the default index.php?
    roy.lu
    C:\DOS... C:\DOS\RUN... RUN\DOS\RUN...!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •