SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I want to produce search engine friendly URLs however I don't know how. I looked at all the other threads about this and really cannot firgure out what to do.

    Can someone please gives me step by step directions.

    Thanx so much.

    -Peter

    EDIT: When I do this, will stuff still work like: select # from article where ID=$id - Here $id would come from the title.???
    Last edited by petesmc; Mar 5, 2001 at 17:35.

  2. #2
    chown linux:users\ /world Hartmann's Avatar
    Join Date
    Aug 2000
    Location
    Houston, TX, USA
    Posts
    6,455
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Try the article at geekarea.org.... It is down at the bottom, http://www.geekarea.org

  3. #3
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That is the one i tried to use but failed.

    Please can anyone give me instructions on what code, and where to put it?

    Thanks

  4. #4
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok...I've semi worked it out:

    Code:
    $url_array = explode("/",$PATH_INFO); 
    for($i=1;$i<count($url_array);$i++) { 
    $data[$url_array[$i]] = $url_array[++$i]; 
    } 
    $extract = @extract($data);
    However, I have one problem. The following code makes a select box but it produces really, really weird results.

    Code:
    <?
    if (count($textarray) > 1) {
    
    // SELECT BOX
    reset($textarray);
    printf('<form action="%s" method="GET" name="theform">', $PHP_SELF);
    print "\n";
    print "<select name=\"page\" onChange=\"document.theform.submit(); \">";
    print "\n";
    foreach($textarray as $key => $value) {
    
    
    
    
    if ($page == $key) { 
    		printf('<option value="%s" selected>%s', $key, $textarray[$key]["title"]);
    print "\n";
    		}
    	else {
    		printf('<option value="%s">%s', $key, $textarray[$key]["title"]);
    print "\n";
    		}
    
    
    	}
    print "</select>";
    print "\n";
    printf('<input type="hidden" name="aid" value="%s">', $aid);
    print "\n";
    print '</form>';
    print "\n";
    //END SELECT BOX
    }
    ?>
    The format of a URL is something like this:

    http://www.codingclick.com/article.p...?page=0&aid=15

    Even though that URL exists, that is really tacky. I also noticed that SP.com doesn't use the search engine friendly URLs in a text box. Is this because it isn't possible?

    Please help...I think I'll do it the old way for select boxes...

    Peter

  5. #5
    One website at a time mmj's Avatar
    Join Date
    Feb 2001
    Location
    Melbourne Australia
    Posts
    6,282
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    ok here's what I have found.

    I've put a file called articles.php into the root web directory (at mostlyamphigory.com).

    If you type
    http://www.mostlyamphigory.com/articles.php/33

    it works,

    but if you type
    http://www.mostlyamphigory.com/articles/33

    It also works! For some reason it realises that "articles" is a php file, and parses it right there and then. Is this normal? I think it is fantastic! I can get articles.php to parse the URI and nobody (not search engines-not nobody) even knows it is php...

    Is this normal, and will it work with everyone? You can try it now at the above addresses. Type ANYTHING YOU WANT after the articles/ - no I haven't set it up to load as an errordocument in an .htaccess or anything...

  6. #6
    One website at a time mmj's Avatar
    Join Date
    Feb 2001
    Location
    Melbourne Australia
    Posts
    6,282
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    petesmc - could you use method=POST instead? That way the extra info is still passed on but not on a query.

    The url could be
    http://www.codingclick.com/article.php/aid/15/page/1

    And the variables $page and $aid would be available in the resulting page, although you don't need them, and you can use the uri.

    Is there a reason I cannot see why this method=post wouldn't work? I'm a beginner, so forgive me if I am totally wrong...

  7. #7
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    It does work now and I'm using it.

    Thanks for all you help

    Peter

  8. #8
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Location
    Washington State
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


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
  •