Page 1 of 2 12 LastLast
Results 1 to 15 of 19

Thread: Search Engine Friendly URL's - Directives

  1. #1
    Registered Mike's Avatar
    Join Date
    May 2003
    Location
    UK
    Posts
    2,755

    Search Engine Friendly URL's - Directives

    Hi,

    I am trying to understand how to create a script like http://www.websitepublisher.net/arti...iendly_urls/3.

    The bit I don't understand is "placing directives inside containers". I don't get how you put it in it, as there aren't any brackets or anything.

    Could somebody help?

    Thanks,
    Mike
    Don't you just love free internet games ?

  2. #2
    Administrator Chris's Avatar
    Join Date
    Feb 2003
    Location
    East Lansing, MI USA
    Posts
    7,055
    Ahh... because containers look like HTML tags the browser is rendering those tags... I will fix it.

    Fixed.
    Chris Beasley - My Guide to Building a Successful Website[size=1]
    Content Sites: ABCDFGHIJKLMNOP|Forums: ABCD EF|Ecommerce: Swords Knives

  3. #3
    Registered Mike's Avatar
    Join Date
    May 2003
    Location
    UK
    Posts
    2,755
    Didn't know it was a bug

    Anyway, would you place the directives inside it like...?

    Code:
    <Files article>
    ForceType application/x-httpd-php 
    article
    </Files>
    Doesn't look right, but it's the only way I can think of.

    Thanks a lot,
    Mike
    Don't you just love free internet games ?

  4. #4
    Administrator Chris's Avatar
    Join Date
    Feb 2003
    Location
    East Lansing, MI USA
    Posts
    7,055
    Code:
    <Files article>
    ForceType application/x-httpd-php 
    </Files>
    Exactly like that. You're applying this directive to a single file "article"
    Chris Beasley - My Guide to Building a Successful Website[size=1]
    Content Sites: ABCDFGHIJKLMNOP|Forums: ABCD EF|Ecommerce: Swords Knives

  5. #5
    Registered Mike's Avatar
    Join Date
    May 2003
    Location
    UK
    Posts
    2,755
    Ah I somehow missed the article part of the fist line

    Thanks for your help...
    Mike
    Don't you just love free internet games ?

  6. #6
    Registered Mike's Avatar
    Join Date
    May 2003
    Location
    UK
    Posts
    2,755
    Coming back onto search engine friendly urls...

    If you link like this, example.com?page=user, how would you link using method three? And if your doing a query like:

    Code:
    $result = mysql_query("SELECT * FROM games WHERE Name='$game'",
    ...how would you do it with search engine friendly urls?

    Thanks a lot,
    Mike
    Don't you just love free internet games ?

  7. #7
    Administrator Chris's Avatar
    Join Date
    Feb 2003
    Location
    East Lansing, MI USA
    Posts
    7,055
    use a url like

    http://www.example.com/game/halflife/

    $var_array = explode("/",$REQUEST_URI);

    $var = $var_array[1]; // contents of variable are "halflife"

    $result = mysql_query("SELECT * FROM games WHERE Name='$halflife";
    Chris Beasley - My Guide to Building a Successful Website[size=1]
    Content Sites: ABCDFGHIJKLMNOP|Forums: ABCD EF|Ecommerce: Swords Knives

  8. #8
    Registered Member incka's Avatar
    Join Date
    Aug 2003
    Location
    Wakefield, UK, EU
    Posts
    3,801
    As this got something to do with my site?

  9. #9
    Registered Mike's Avatar
    Join Date
    May 2003
    Location
    UK
    Posts
    2,755
    Ok, so to list all the links on a page you'd have something like...?

    Code:
    $result = mysql_query("SELECT * FROM games");
    
    for ($x=0; $x < mysql_num_rows($result); $x++) {
    $row = mysql_fetch_assoc($result);
    
    echo ("<a href='http://www.example.com/game/");
    echo $row['Name'];
    echo ("'>")
    	}
    And to have the game on the next page have something like this, and the echo statements?

    Code:
    $var_array = explode("/",$REQUEST_URI); 
    
    $var = $var_array[1];
    
    $result = mysql_query("SELECT * FROM games WHERE Name='$var";
    Also what is $REQUEST_URI please?

    Thanks a lot for all your help,
    Mike
    Don't you just love free internet games ?

  10. #10
    Senior Member chromate's Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    2,348
    That looks about right Mike.

    Be careful with your Syntax though. You're missing a few quotes, brackets and semi-colons. I know you'd pick that up in the final script though.

    Also, try:

    PHP Code:

    $result 
    mysql_query("SELECT * FROM games");

    while( 
    $row mysql_fetch_array($result) ) {
       echo 
    "<a href=\"http://www.example.com/game/".$rw['Name']."\">";

    Just looks a little cleaner, maybe

  11. #11
    Registered Mike's Avatar
    Join Date
    May 2003
    Location
    UK
    Posts
    2,755
    Thanks Chromate

    Yeh and I agree about the Syntax, I usally get at least three parse errors when checking

    Anyway, thanks a lot...
    Mike
    Don't you just love free internet games ?

  12. #12
    Senior Member chromate's Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    2,348
    Tell me about it. The reason I pointed it out is that I'm terrible myself, though much better than I was! I've spent ages getting really frustrated before because I couldn't find an error and then after about an hour, I find I've neglected to put in a quotation mark or something equally dumb! Bloody annoying if you have a deadline! haha

  13. #13
    Registered Mike's Avatar
    Join Date
    May 2003
    Location
    UK
    Posts
    2,755
    lol yeah

    i made this script a few weeks ago, uploaded it to my host and decided not to save it as i thought it would be safe. anyway, it wasn't and it somehow got deleted.

    so i tried to make it all again (only short). so i did it, uploaded it and got this ugly error (not saying what was missing). it pointed me to a line that had nothing wrong with it. anyway, after about an hour of fiddling about i finally found out that there was a missing quotation. grrr

    why they can't make some sort of editor that corrects these mistakes...
    Don't you just love free internet games ?

  14. #14
    Senior Member chromate's Avatar
    Join Date
    Aug 2003
    Location
    UK
    Posts
    2,348
    Originally posted by Mike
    why they can't make some sort of editor that corrects these mistakes...
    They do on a basic level. But in my experience they're more trouble than they're worth. It's best just to get into good practice to start with. Having said that, I started programming in Java which isn't very forgiving.

    Now, what really annoys me as far as errors are concerned is Perl CGI. GRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR RRRRRRRRRRRRRrrrrrrrrrrrrrrrrrr

  15. #15
    Administrator Chris's Avatar
    Join Date
    Feb 2003
    Location
    East Lansing, MI USA
    Posts
    7,055
    $REQUEST_URI is a variable that represents the requested file path after the domain.
    Chris Beasley - My Guide to Building a Successful Website[size=1]
    Content Sites: ABCDFGHIJKLMNOP|Forums: ABCD EF|Ecommerce: Swords Knives

Similar Threads

  1. Search Engine Friendly URLs Problem
    By cameron in forum Search Engine Optimization
    Replies: 5
    Last Post: 02-24-2004, 08:43 PM
  2. Search Engine friendly urls ?
    By Dan in forum Search Engine Optimization
    Replies: 6
    Last Post: 02-11-2004, 06:26 PM
  3. IIS 4.0 + Search Engine Friendly URL's
    By Stevens in forum Website Programming & Databases
    Replies: 14
    Last Post: 02-03-2004, 08:51 PM
  4. are iframes search engine friendly?
    By grichards in forum Search Engine Optimization
    Replies: 1
    Last Post: 01-04-2004, 10:58 AM
  5. Search Engine Friendly URLS
    By dolphin in forum Search Engine Optimization
    Replies: 8
    Last Post: 12-01-2003, 09:01 PM

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
  •