keywords into links
I want to design a script that allows me to add dynamic links to certain keywords (will provide links via php).
I have been searching for ages now, looking for a js snippet that will read a page and add links to certain keywords...
Anyone know of any? How would i do it?
I'd use PHP for this.
-A function myReplacer where you get all the contents of the page using ob_get_contents(), after getting the contents clean the output buffer using ob_clean();
-A preg_replace statement to separate the body from the rest
-A loop to cycle through a bunch of keywords (using a database containing a number of links and keywords associated with the links).
-Within the loop use preg_replace to replace all occurences of a keyword with a link -if the keyword is not in a link yet or between any tags.