Results 1 to 6 of 6

Thread: very easy qustion??HELP??

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2002
    Posts
    106

    Question very easy qustion??HELP??

    Hi

    I need a very simple php page but I couldn't write it yet
    I need some help

    the page should do this job:


    if we goto www.mydomain.com/page.php
    the page should do this :
    include('body/index_body.php');

    if we goto www.mydomain.com/page.php?mode=index
    the page should do this :
    include('body/index_body.php');

    if we goto www.mydomain.com/page.php?mode=phpbb
    the page should do this :
    include('body/phpbb_body.php');

    if we goto www.mydomain.com/page.php?mode=about
    the page should do this :
    include('body/about_body.php');



    HOW CAN I DO THIS
    PLEASE HELP

    THANKS
    AL_TNEN

  2. #2
    Registered User
    Join Date
    Feb 2003
    Posts
    57
    PHP Code:
    if (!isset($mode)){
    $incfile "index_body.php";
    }
    if (
    $mode=="index"){
    $incfile "index_body.php";
    } elseif (
    $mode=="phpbb"){
    $incfile "phpbb_body.php";
    } elseif (
    $mode=="about"){
    $incfile "about_body.php";
    } else {
    $incfile "index_body.php";
    }
    include(
    "body/$incfile"); 
    I think that should work - not tested.

    s.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2002
    Posts
    106
    THANKS silva, BUT THIS ISN"T WORKING

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Originally posted by Tnen
    THANKS silva, BUT THIS ISN"T WORKING
    Are you $_GETting the string properly?

    Post all your code, plz.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Aug 2002
    Posts
    106
    THIS IS ALL

    PHP Code:
    <?php

    if (!isset($mode)){
    $incfile "index_body.php";
    }
    if (
    $mode=="index"){
    $incfile "index_body.php";
    } elseif (
    $mode=="phpbb"){
    $incfile "phpbb_body.php";
    } elseif (
    $mode=="about"){
    $incfile "about_body.php";
    } else {
    $incfile "index_body.php";
    }
    include(
    "body/$incfile");

    ?>

  6. #6
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337

    Re: very easy qustion??HELP??

    Originally posted by Tnen
    Hi

    I need a very simple php page but I couldn't write it yet
    I need some help
    if it is so simple then why can't you do it??? and how do you know if it is simple if you can't do it in the first place.

    PHP Code:
    <?php
    switch $_GET["mode"]{

    case 
    "phpbb":
        include(
    "body/phpbb_body.php");
        break;
    case 
    "about":
        include(
    "body/about_body.php");
        break;
    default:

        include(
    "index_body.php");
    }
    ?>

Posting Permissions

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



Click Here to Expand Forum to Full Width