Automatic linking of specific terms... - Posted (2252 Views)
Senior Member
bobby131313
Posts: 1163
1163
Kind of like some of those advertising services do... Auto-link certain words to relevant ads.
Except I'm not thinking of ads, more like educational help. I have a pretty extensive site built around my forum and would like to raise awareness and help people learn.
For example, if someone uses the exact phrase large cent in a post, it would be cool if it automatically linked like so, large cent. Perhaps with a slightly different link color or a little arrow next to it (like Wikipedia) so users get accustomed to it being an on-site educational link.
I tried using the bad word filter, but the fields are a little too short. tongue
Has anyone done anything like this?
<
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Forum Admin
HuwR
Posts: 20611
20611
just create yourself a new table to store the various links/phrases in and just duplicate the badwordfilter function but select the values from your new table, then at the end of the badword filter, just call your new function.<
Posted
Senior Member
bobby131313
Posts: 1163
1163
Thanks Huw, I'm going to give it a go this week. bigsmile<
Posted
Senior Member
leatherlips
Posts: 1838
1838
If you get this to work, I may be interested. Keep us posted of your progress.<
Posted
Senior Member
bobby131313
Posts: 1163
1163
Haven't had time to play with this yet, but it has been on my mind.
I have a question. It appears, from my memory tongue, that the bad word filter works 2 ways.
New posts (and edited posts?) it actually changes what's entered into the DB, but posts previous to the BW entry, just being viewed, get changed using server variables.
Is that correct?<
Posted
Snitz Forums Admin
ruirib
Posts: 26364
26364
Originally posted by bobby131313
Haven't had time to play with this yet, but it has been on my mind.
I have a question. It appears, from my memory tongue, that the bad word filter works 2 ways.
New posts (and edited posts?) it actually changes what's entered into the DB, but posts previous to the BW entry, just being viewed, get changed using server variables.
Is that correct?
Actually your mixing up different things. Badwords and replacement words are kept in app variables, no matter what.
When a post is created, badwords are replaced and their substitutes stored in the database, as integral part of the post. When a topic is displayed, badword filtering is done again, so even badwords that were not on the list when the post was created get filtered on display.
Both when replacing words on a new post creation op or when displaying a existing topic, app variables contents are used, unless they are blank, in which case the app variables get reloaded from the database.<
Posted
Senior Member
bobby131313
Posts: 1163
1163
OK, I think I understand.
This being the case, I don't think I want to duplicate the Bad Word functionality exactly for this.
I don't think I would want the database entry to be altered. For the simple reason when someone edits a post all the new code would be there and runs the risk of getting butchered.
I'm thinking I would just want these filtered on display, not in the DB.
I'll have to see what it looks like when I get to it.
Thanks! bigsmile<
Posted
Snitz Forums Admin
ruirib
Posts: 26364
26364
SHouldn't be too difficult. The new function just needs to be used in topic.asp, not in post_info.asp.<
Posted
Senior Member
bobby131313
Posts: 1163
1163
Cool. Does my reasoning make sense to you though?<
Posted
Average Member
phy1729
Posts: 589
589
I think there's a function in inc_func_common.asp that only parses from the db not into. You may want to stick this into there.<
Posted
Snitz Forums Admin
ruirib
Posts: 26364
26364
Originally posted by bobby131313
Cool. Does my reasoning make sense to you though?
Regarding no changes to the actual post contents in the DB?<
You Must enter a message