Automatic linking of specific terms...

Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/66703?pagenum=1
05 November 2025, 11:08

Topic


bobby131313
Automatic linking of specific terms...
22 March 2008, 16:57


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?
<

 

Replies ...


HuwR
22 March 2008, 19:27


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.<
bobby131313
23 March 2008, 11:35


Thanks Huw, I'm going to give it a go this week. bigsmile<
leatherlips
23 March 2008, 11:55


If you get this to work, I may be interested. Keep us posted of your progress.<
bobby131313
22 April 2008, 17:06


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?<
ruirib
22 April 2008, 17:19


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.<
bobby131313
22 April 2008, 18:24


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<
ruirib
22 April 2008, 18:37


SHouldn't be too difficult. The new function just needs to be used in topic.asp, not in post_info.asp.<
bobby131313
22 April 2008, 18:43


Cool. Does my reasoning make sense to you though?<
phy1729
22 April 2008, 18:54


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.<
ruirib
22 April 2008, 18:54


Originally posted by bobby131313
Cool. Does my reasoning make sense to you though?
Regarding no changes to the actual post contents in the DB?<
bobby131313
22 April 2008, 18:57


Regarding no changes to the actual post contents in the DB?

Yes. Make sense to you?<
ruirib
22 April 2008, 19:17


Yeah, makes total sense, since it will allow you to change the destination link whenever you want, still based on the same input word(s). Better option, IMHO.<
bobby131313
22 April 2008, 19:30


Cool, if I have issues when I get to it I'll be back. tongue<
weeweeslap
26 May 2008, 13:23


How did this go? I have a need for this on one of my sites and would like to know if it worked out and if you would share the code. Thanks<
bobby131313
26 May 2008, 14:34


I'm afraid I still haven't gotten to it weewee. blush<
cripto9t
26 May 2008, 16:20


If you don't mind editing files You can use an xml file to store your keywords. I use one for my sports pool to store the team names and cities. I thought about using a table at first, but decided it would be easier to use xml instead of writing a program to add and remove teams or update the db manually.
sample
Code:
<sitekeys>
<key id="1">
<phrase>Morgan Dollar</phrase>
<link>Link</link>
</key>
<key id="2">
<phrase>Large Cent</phrase>
<link>Link</link>
</key>
</sitekeys>
Just a thought smile<
leatherlips
26 May 2008, 17:12


I have a thread that uses a dictionary script. I have a question on there that if answered could possibly do what you want very easily. I need to know if the Snitz search page can search through the URL. If it can, then this may do what you want.
Here is the thread I am referring to:

http://forum.snitz.com/forum/topic.asp?TOPIC_ID=67086

What it could potentially do is allow you to double click any word in your forum and have it list the search results of that term. However, the snitz search uses a DoIt and I can not figure out how to add the search term to the url and have it search. It either just goes to the search page itself or it says no keywords entered.
For example, if you use Google to search you could enter in the URL:

http://www.google.com/search?hl=en&q=

Then enter your search term like this (shown in red):

http://www.google.com/search?hl=en&q=snitz
This would let google show all the search result for snitz. If snitz could be used the same way then the dictionary script could be pointed to the snitz search url.<
weeweeslap
27 May 2008, 13:31


cripto9t, that's all it would take? I would like include the page into the inc_header.asp file? I don't mind editing files smile<
cripto9t
27 May 2008, 14:33


No, it would take more than that smile. You don't use the xml as an include. there's code to access it just like a db. And you would still need a function to loop the text and do the replacing.
What I meant was, when you want to add or remove a phrase or word, you would just need to edit the xml file instead of the db.
Give me a little time to bone up on my xml and I'll see if I can come up with something.<
weeweeslap
27 May 2008, 18:26


okie dokie smile Thanks!<
cripto9t
28 May 2008, 17:13


I posted my code for this in the mods w/code forum. Uses a xml file that you edit manually instead of the db, so its not the most user friendly. But for you hands on types there should be no problems smile.
Very easy install<
© 2000-2021 Snitz™ Communications