Automatic linking of specific terms... - Postet den (2254 Views)
Senior Member
bobby131313
Innlegg: 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?
<
   
 Sidestørrelse 
Postet den
Forum Admin
HuwR
Innlegg: 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.<
Postet den
Senior Member
bobby131313
Innlegg: 1163
1163
Thanks Huw, I'm going to give it a go this week. bigsmile<
Postet den
Senior Member
leatherlips
Innlegg: 1838
1838
If you get this to work, I may be interested. Keep us posted of your progress.<
Postet den
Senior Member
bobby131313
Innlegg: 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?<
Postet den
Snitz Forums Admin
ruirib
Innlegg: 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.<
Postet den
Senior Member
bobby131313
Innlegg: 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<
Postet den
Snitz Forums Admin
ruirib
Innlegg: 26364
26364
SHouldn't be too difficult. The new function just needs to be used in topic.asp, not in post_info.asp.<
Postet den
Senior Member
bobby131313
Innlegg: 1163
1163
Cool. Does my reasoning make sense to you though?<
Postet den
Average Member
phy1729
Innlegg: 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.<
Postet den
Snitz Forums Admin
ruirib
Innlegg: 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?<
Du må legge inn en melding