Log in

View Full Version : Need to replace a word in posts but not in titles


amykhar
03-11-2003, 10:53 PM
I just tried to use a replacement, but it replaces the word in thread titles as well.

Basically, I am trying to replace all instances of a word in a post with a link that I specify. Regular expressions make my eyes cross so I am going to need a wee bit of assistance on getting this one going please.

Amy

filburt1
03-11-2003, 11:03 PM
If you want to do all past posts, you can use REPLACE in an UPDATE query. If you mean all future posts...no idea. You'd need a new hack.

mr e
03-11-2003, 11:43 PM
you'd probably have to edit functions.php for the postbit part(unless you want it permanent, then just do a query), newreply.php, and newthread.php, not sure what you'd have to do right off hand though

amykhar
03-12-2003, 02:33 PM
I am wondering if javascript would do it or something similar? You know those ad banners that change words on pages to links? Anybody know if such a thing exists in javascript?

filburt1
03-12-2003, 04:31 PM
Javascript is virtually never the answer to any problem ;)

amykhar
03-12-2003, 05:07 PM
I got it. I added a function in functions.php that does a string replace on the post before it is parsed for vbcode, etc. It works like a charm and this should help my affiliate programs do a bit better.

Amy

Boofo
03-12-2003, 05:32 PM
I wish I had seen this message earlier. I just got through doing the very same thing a few days ago. Easy, wasn't it? ;)