View Full Version : auto search and replace keywords with links

06-04-2005, 01:09 PM
I just found this forum and it is a great resource.

I have been looking for a way to search and replace keywords with affliate links. I have seen this on many sites and forums or blogs. Basically, if I write buy.com, the "buy.com" is automatically with an affiliate link.

Some forum softwares have that word censor feature that would allow to replace words with '***'.

Is there a way/a script that would automatically scan your site or a field of your database to achieve this? Can someone point me to that?


06-04-2005, 07:09 PM
This is a simple function, but it will differ for each CMS or forum. So without knowing what software you use I can't give you a recommendation, and if you use custom software you'll have to write it yourself. Luckily its a simple thing and if you've coded a basic CMS you have the skills needed.

FYI this forum has something like that for adnetworks like Fastclick or Adsense .

06-04-2005, 09:48 PM
Thanks Chris,

I think you understood exactly what I was trying to describe.

I am not a programmer, so I have only an idea how the logic works, but not the coding.

I want to apply the script to oscom (but I think that the script should work for any CMS system), when each time I add a new item description, I want call the script to search the for keywords and replace them with affiliate links. The same would apply everytime a user write and submit a review.

Do you mind pointing me to some ready made scripts, I have search all the depositories, but nothing match closely (or if it is not too much of an inconvenience, do you mind posting the code?)

<test adsense test>

06-05-2005, 05:56 AM
With oscommerce it'd be complicated, thats nearly as complicated as a forum but less organized in the code.

Basically to do this requires a database of links and link replacement text.

Then you simply do a str_replace function to after pulling the links.

It'd be easy for any php coder to do, but I'd find someone who is an expert with OSC's backend, since it's going to be complicated. Also make the change on the output, not the input. In otherwords change the text when the reviews/products are displayed, not entered. That way if you delete a link from your database it'll be gone from all reviews/products at the same time.

06-05-2005, 10:18 AM
Thanks Chris,

I think it would be easy for a programmer to do, this feature is native to most forum software. It would just be easy to take the chunk of code and apply to osc as a contrib.

06-29-2005, 12:26 PM
i was about to share my code on how i do it... but its not for a CMS system so its not really of any value. have you tried googling it? cheers.