I'm not exaclty sure if this is the correct title as I'm not completely sure how I should go about tackling this problem.
Anyway, I currently have a bunch of static HTML pages. What I want to do is make the server automatically search for some strings and replace them with a predefined link that would be read from a mySQL database. If possible, check to see if the text is already part of another link, if it is, then ignore that entry and go on to the next one.
The tricky thing with this problem is I need the modification to be done only when the pages get requested as the links from the database is always subject to change and I do not want to keep 2 copies of the whole page (the original and processed versions) as that increases the chances for things to mess up.
Anyway help/suggestion would be greatly appreciated. Thanks in advance