1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

I will pay someone $5 whoever answers this php question first

Discussion in 'Services' started by Cheyne, May 15, 2007.

  1. #1
    Hi

    $5 (Paypal only) to whoever answers this question first (and works for me).

    (Post your answer in the thread for fairness)

    I have a page where the main content area pulls its data from

    <?php
    include 'home.php';
    ?>
    PHP:
    I want to have another page that, instead of, using home.php it uses about.php

    And need to be able to switch this via the URL eg.
    www.website.com/index.php?page=about
    www.website.com/index.php?page=services
    www.website.com/index.php?page=contactus

    etc etc

    If that makes any sense.

    Thanks!
     
    Cheyne, May 15, 2007 IP
  2. Choller

    Choller Peon

    Messages:
    388
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    
    switch ($_GET['page']) {
    case "about":
        include 'about.php';
        break;
    case "services":
        include 'services.php';
        break;
    case "contactus":
        include 'contactus.php';
        break;
    }
    
    PHP:
     
    Choller, May 15, 2007 IP
  3. Cheyne

    Cheyne Peon

    Messages:
    351
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #3
    And where do I put that?
     
    Cheyne, May 15, 2007 IP
  4. Choller

    Choller Peon

    Messages:
    388
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #4
    Replace your php line with this
    
    switch ($_GET['page']) {
    case "about":   
        include 'about.php';    
        break;
    case "services":    
        include 'services.php';    
        break;
    case "contactus":    
        include 'contactus.php';    
        break;
    default:    
        include 'home.php';    
    }
    
    PHP:
     
    Choller, May 15, 2007 IP
  5. mikey1090

    mikey1090 Moderator Staff

    Messages:
    15,869
    Likes Received:
    1,055
    Best Answers:
    0
    Trophy Points:
    445
    Digital Goods:
    2
    As Seller:
    100% - 3
    As Buyer:
    100% - 0
    #5
    
    $page = $_REQUEST['page'];
    
    switch ($page) {
    
    case "about":    
    include 'about.php';    
    break;
    
    case "services":    
    include 'services.php';    
    break;
    
    case "contactus":    
    include 'contactus.php';    
    break;
    }
    PHP:
    add that code under the

    <?php 
    
    include 'home.php'; 
    
    
    PHP:
     
    mikey1090, May 15, 2007 IP
  6. Cheyne

    Cheyne Peon

    Messages:
    351
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #6
    Thanks Choller, it worked.

    PM me your paypal

    Thanks!
     
    Cheyne, May 15, 2007 IP
  7. Choller

    Choller Peon

    Messages:
    388
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #7
    Ah man, don't worry about the money ;)
     
    Choller, May 15, 2007 IP
    Cheyne likes this.
  8. Cheyne

    Cheyne Peon

    Messages:
    351
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #8
    Thanks for that, I appreciate it. Rep added. Feel free to shoot me a PM if your ever $5 short on something ;)

    PM me with a site you own and I'll give you a backlink on a PR site for a couple months
     
    Cheyne, May 15, 2007 IP
  9. Felu

    Felu Peon

    Messages:
    1,680
    Likes Received:
    124
    Best Answers:
    0
    Trophy Points:
    0
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #9
    One more thing.
    [b]if(isset($_GET['page'])){[/b]
    switch($_GET['page']){
    ....
    }
    [b]}[/b]
    
    Code (markup):
    Make it like that :).
     
    Felu, May 15, 2007 IP