What is the best way to convert plain text into html links based on a set of keywords… more…? | Text Links

What is the best way to convert plain text into html links based on a set of keywords… more…?


I have a table of keywords that can be updated/added:
Example:
dating
newspaper
travel

And I have another table that contains data from posts on my message board/forum. What is the best way to go through and link the text inside the fourm posts if the text matches any of the keywords?

It sounds simple at first, but the more I think about it, the more complicated it is. Seems that therea re a couple different ways:

1) Before a post gets inserted into my forum database, go through all the text and replace all the keywords with approriate links.
– This would take a long time up front and would not account for new keywords added after the post.

2) Have a service that runs all the time in the background that is constantly mining the posts and replacing matching keywords with links.
– Complicated and not instant

There are probably more options, but these are the two I’ve come up with. Anybody know an easy way to do this?

You’ll need to use a table in a database that has at least two fields one would be a keyword field and the other would be related link to that word. For instance the word ford could create a link to www.ford.com. Also you would have to think in some situations such as ford explorer so that this would link to a page related to the ford explorer or simply ford.

The best situation is to replace the words for links when the post is inserted at a database otherwise the post might take much time to appear due to that it is being processed by your script.

Related posts:

  1. Is it possible to send an html email that contains a drop down menu rather than text links? Thanks!?
  2. What is the HTML so that I can cover up Links with TEXT?
  3. I need to change URL’s into Html text links and paste them to a page?
  4. html codes for links on a text CD?
  5. How should text links be constructed to capture multiple keywords?

One Response

  1. rafaelbortoletto Says:

    You’ll need to use a table in a database that has at least two fields one would be a keyword field and the other would be related link to that word. For instance the word ford could create a link to http://www.ford.com. Also you would have to think in some situations such as ford explorer so that this would link to a page related to the ford explorer or simply ford.

    The best situation is to replace the words for links when the post is inserted at a database otherwise the post might take much time to appear due to that it is being processed by your script.
    References :
    RBM

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.