SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Re-learning PHP

  1. #1
    SitePoint Member BZON Erik's Avatar
    Join Date
    Oct 2001
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re-learning PHP

    Hello Everyone.

    I am currently RE-LEARNING PHP, yes, I said RELEARNING. I forgot everything due to school but I wasn't exactly that great before anyways. Here we go:

    I am trying to make http://www.below-zero.com/index.php display newspro, right? How can I set the index.php to display it when I have stuff like http://www.below-zero.com/index.php?area=join and http://www.below-zero.com/index.php?area=contact are all ready displaying things? Would I have to make a index2 or something? I've seen webpages do this before but I have no idea on how to do it myself.

    Also: the join and contact are .txt's
    CEO of Below Zero Online Networks - Coming Soon...
    I need to learn more PHP and MySQL!

  2. #2
    SitePoint Guru
    Join Date
    Aug 2001
    Location
    Amsterdam
    Posts
    788
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    hmm

    I don't know what it is that you really want but if you just link to a page like the the example you used.

    http://www.below-zero.com/?area=join this means that the index.php will be processed where variable $area is join.

    In the script somewhere the webmaster will have make an if statement checking the value for $area like so:
    Code:
    if ($area == "join")
    {
    //Do stuff
    }
    else if ($area == "members")
    {
    //do stuff for members... 
    }
    That is how you can process the variable value...

    Good luck,

    Peanuts
    the neigbours (free) WIFI makes it just a little more fun

  3. #3
    SitePoint Member BZON Erik's Avatar
    Join Date
    Oct 2001
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would put that inside the index.php while having newspro in it under it?

    I need the newspro to disapear once you go to ?area=join

    Please explain further. I need this ASAP! Thanks in advance, Erik Shafer.
    CEO of Below Zero Online Networks - Coming Soon...
    I need to learn more PHP and MySQL!

  4. #4
    SitePoint Guru
    Join Date
    Aug 2001
    Location
    Amsterdam
    Posts
    788
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't really get what you want but if you put that in the index you can select what the index file will display on the screen.. each time the index is requested the whole page will be build up from scratch.. so if you want the page to display a form to join you can just do it like this:

    Code:
     
    <?
    //need my vars and functions
    require('basics.php');
    // first the HTML header for the page
    include('header.php');
    //now the menu or navigation of the site
    include('nav.php'); //this is just a file with links etc
    
    if($area == "younameit")
    {
    //do stuff and display in HTML
    ?>
    HTML stuff 
    <?
    }
    else if($area == "members")
    {
    //Get memberpage etc... 
    }
    etcetc...
    Now if you want certain stuff to always be displayed then you need to keep it out of the if funtions or put it in everyone of them!!!


    For my site I use a database to fill all the stuff on the pages so what I then do is use the variable to select the correct data from the database and echo this.. This way I only need one file to display all standard pages..
    the neigbours (free) WIFI makes it just a little more fun


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
  •