Navigation Solution Needed

Discussion in 'PHP' started by Declan127, Feb 22, 2009.

  1. #1
    Hello,

    I'm working on a site and have hit a bit of a problem when it comes to specific pages such as profiles.

    I have decided to opt for the commonly used method of ?page=home and then include the home.php file.

    Here is an example of how im doing it:
    if 	($page == 'tos'){ 				$include = 'tos.php';}
    elseif	($page == 'updates'){				$include = 'news_updates.php';}
    elseif	($page == 'credits'){				$include = 'credits.php';	}
    PHP:
    But when it comes to a page that has its own ?= on the end, eg profile.php?view=Declan, I'm stuck on how to get around it.

    All help will be appreciated, thanks.
    Declan.
     
    Declan127, Feb 22, 2009 IP
  2. Agent_Smith

    Agent_Smith Well-Known Member

    Messages:
    890
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    145
    #2
    You use

    If i understood your question correctly that is.

    Thanks!
     
    Agent_Smith, Feb 22, 2009 IP
  3. Declan127

    Declan127 Peon

    Messages:
    76
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Would that work, because the view=????? would be a $_GET, how would I include that?
     
    Declan127, Feb 22, 2009 IP
  4. Agent_Smith

    Agent_Smith Well-Known Member

    Messages:
    890
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    145
    #4
    // ?page=yourpage&view=DDDeclan 
    
    $page = $_GET['page'];
    echo $page;
    // would be "yourpage"
    
    
    $view = $_GET['view'];
    echo $view;
    // would be "DDDeclan"
    
    PHP:
    Yeah, you can keep adding & to create complex urls.

    ?page=yourpage&view=DDDeclan&id=6&forum=54
     
    Agent_Smith, Feb 22, 2009 IP
  5. Declan127

    Declan127 Peon

    Messages:
    76
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks alot, I'm an idiot :)!
     
    Declan127, Feb 22, 2009 IP