www.webdeveloper.com
Results 1 to 4 of 4

Thread: How is this done?

  1. #1
    Join Date
    Mar 2003
    Location
    Somewhere on Planet Earth, I hope.
    Posts
    987

    How is this done?

    Hi there.
    I've seen on various sites navigation like http://www.url.com/?mod=about

    How is that achieved?

    My old "page.php" which would load i.e. page.php?p=about worked -- but how is it achieved with just a ?mod=about

    Thanks.

    The page.php code:

    PHP Code:
    <?php 
    if (isset($_GET['p'])) { 
        
    $p = (strstr($_GET['p'], ".php")) ? $_GET['p'] : $_GET['p'].".php"
        if (
    file_exists($p)) {
            include 
    $p
        } 
        else {
            include 
    "index.php"
        }
    }
    else {
        include 
    "index.php"
    }
    ?>

  2. #2
    Join Date
    May 2003
    Location
    Millis, MA
    Posts
    453
    It works the same way, but the code is in the index page.

    "http://www.url.com/?mod=about" is the same as "http://www.url.com/index.php?mod=about".

  3. #3
    Join Date
    Mar 2003
    Location
    Somewhere on Planet Earth, I hope.
    Posts
    987
    I presume i'd need to change that code though???

    Thanks.

  4. #4
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    10,413
    Originally posted by skydan
    I presume i'd need to change that code though???
    Only if you are going to change it from "p" to "mod."

    [J]ona

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles