SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    Dec 2000
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Alternative to Query Strings

    Hello all,

    I know that there have been several posts on this same topic: How to use slash marks instead of query strings. For a newbie, this can be challenging, so I have done a lot of research and came up with the following:
    PHP Code:
    // fetch the possible article ids and chapter ids
    $url_array explode("/",$PATH_INFO);
    $catid=$url_array[1];
    $id=$url_array[2];
    $chapid[b]=$url_array;[/b
    Everything needs to remain intact except where it says $catid, $id, and $chapid, those need to be changed to the value of your variable that is the unique identifier. Also, the numbers ([1], [2], [3]...) need to be changed depending on what order it is.

    If something doesn't make sense, email or PM me and I'll try to help you out.

    Special thanks to Erik Johansen of Netmaking for all of his help.
    Last edited by JustForWebmasters; Jun 11, 2001 at 12:30.
    Corbb O'Connor
    Looking for quality website design or database programming?
    Contact me for more information and a FREE quote!

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay so I get what you are trying to do here, and I have been actively participating in those posts you mentioned but here is an even better way to do it. Add your variable names in to the query string as well for example in youre example you have $catid $id and $chapid so you could do this where you take the path_info var and break it up to create the keys and vals of a new array automatically then you can use extract() to create the vars you need.

    PHP Code:
    <?
    $url_array 
    explode("/"$PATH_INFO);
    $i 1;
    while(
    $i <= count($url_array)) {
        
    $tmp_array[$url_array[$i]] = $url_array[$i 1];
        
    $i += 2;
        }
    extract($tmp_array);
    print 
    "catid = $catid<br>";
    print 
    "id = $id<br>";
    print 
    "chapid = $chapid<br>";
    ?>
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    Serial Publisher silver trophy aspen's Avatar
    Join Date
    Aug 1999
    Location
    East Lansing, MI USA
    Posts
    12,939
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As of this time pages with urls done in this manner will not be indexed by google. I've been in contact with a software developer at google and they are aware of the problem but he hasn't said if they've fixed it (or are going to).
    Chris Beasley - I publish content and ecommerce sites.
    Featured Article: Free Comprehensive SEO Guide
    My Guide to Building a Successful Website
    My Blog|My Webmaster Forums


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
  •