how to make a name auto-link

Discussion in 'Programming' started by 5thround, Oct 25, 2008.

  1. #1
    I'm curious as to which script I can use to make it where if i type it somebody's name, it'll auto-link to a profile page that I've made for that person.

    Like on ESPN.com, if you see Kobe Bryant's name, it'll link to his player profile page automatically.
     
    5thround, Oct 25, 2008 IP
  2. ToddMicheau

    ToddMicheau Active Member

    Messages:
    183
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    58
    #2
    There are a couple ways of doing this, I think they save their news stories to a database, and when pulling from the database a script formats every keyword it finds. I think you can also do this with Javascript- the JS will loop through the page and change the text to a link if it finds certain keywords. Though the JS method isn't that great unless you've got a alot of time on your hands and / or a small amount of keywords.

    That's an interesting thought though. I would make a pass-through function that requires text- it then pulls from an associative sql table (IE KEY, KeyWord, Link), then replaces those keywords that it finds with the proper links and returns the updated text. I would not suggest using a pass-through live, I would use it only when you add a news story to your site (if that's what your using it for.)

    That and using this database pass-through method you can easily update keywords and their links. If your building a blod script then it could even check the passed text for other blog post names, and update the text accordingly. . .
     
    ToddMicheau, Oct 25, 2008 IP