Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Keyword Links - Last Update 6/9/08

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!
Before posting, make sure you have read this topic!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
cripto9t Posted - 28 May 2008 : 16:55:41
I'm sure you've been to some web sites where certain keywords are links. Thats what this mod does.

The keywords and urls are stored in an xml file that you will have to create and edit.
Here's a sample
<?xml version="1.0" encoding="ISO-8859-1"?>

<keywords>

    <!-- Start Keywords -->
    <key>
        <phrase>xml</phrase>
        <url>http://some/site.xml</url>
    </key>
    <key>
        <phrase>html</phrase>
        <url>http://some/site.html</url>
    </key>
    <b><font color="red"><key>
        <phrase>css</phrase>
        <url>http://some/site.css</url>
    </key></font id="red"></b>
</keywords>

Just copy and paste that into your word editor and save it with a .xml extension.
The part in <b><font color="red">red</font id="red"></b> is what you need to worry about when you add a keyword.
Just add another <key> tag within the <keywords> tag.
The tag structure is very important and must be maintained.
Make sure the tags are in that order and they all have the closing tags.

Now the easy part.
Open "inc_function_common.asp"
<ul>
<li>Find the FormatStr function.
find these lines
function FormatStr(fString)
 on Error resume next

ADD this line right under that
fString = ChkKeys(fString)
</li><li>
Add this code before this line "%>" near the bottom of the file.
Function ChkKeys(fString)
    dim strKeys,strReplace,keywords,keyreplace,objRegex

    'file check
    if ShowKeyWords = False then
        ChkKeys = fString
        Exit Function
    end if

    if trim(Application(strCookieURL & "STRKEYWORDS")) = "" or trim(Application(strCookieURL & "STRKEYREPLACE")) = "" then
 LoadKeywordApps
    end if

    strKeys = Application(strCookieURL & "STRKEYWORDS")
    strReplace = Application(strCookieURL & "STRKEYREPLACE")
    if fString = "" or IsNull(fString) then fString = " "
        keywords = split(strKeys, ",")
        keyreplace = split(strReplace, ",")

    set objRegex = new RegExp
    objRegex.ignorecase = true
    objRegex.global = true

    for i = 0 to ubound(keywords)

        strPattern = "^(" & keywords(i) & ")(\s)"
        strReplace = keyreplace(i) & "$2"
        objRegex.pattern= strPattern
        fString = objRegex.replace(fString,strReplace)

        strPattern = "(" & keywords(i) & ")$"
        strReplace = keyreplace(i)
        objRegex.pattern= strPattern
        fString = objRegex.replace(fString,strReplace)


        fString = Replace(fString, " " & keywords(i) & " ", " " & keyreplace(i) & " ", 1, -1, 1) 
        fString = Replace(fString, " " & keywords(i) & ",", " " & keyreplace(i) & ",", 1, -1, 1)
        fString = Replace(fString, " " & keywords(i) & ".", " " & keyreplace(i) & ".", 1, -1, 1)
        fString = Replace(fString, " " & keywords(i) & ":", " " & keyreplace(i) & ":", 1, -1, 1)
        fString = Replace(fString, " " & keywords(i) & ";", " " & keyreplace(i) & ";", 1, -1, 1)
        fString = Replace(fString, " " & keywords(i) & "!", " " & keyreplace(i) & "!", 1, -1, 1)
        fString = Replace(fString, " " & keywords(i) & "?", " " & keyreplace(i) & "?", 1, -1, 1)

        fString = Replace(fString, "-" & keywords(i) & "-", "-" & keyreplace(i) & "-", 1, -1, 1)
        fString = Replace(fString, "-" & keywords(i) & " ", "-" & keyreplace(i) & " ", 1, -1, 1)
        fString = Replace(fString, " " & keywords(i) & "-", " " & keyreplace(i) & "-", 1, -1, 1)

        fString = Replace(fString, "_" & keywords(i) & "_", "_" & keyreplace(i) & "_", 1, -1, 1)
        fString = Replace(fString, "_" & keywords(i) & " ", "_" & keyreplace(i) & " ", 1, -1, 1)
        fString = Replace(fString, " " & keywords(i) & "_", " " & keyreplace(i) & "_", 1, -1, 1)

        fString = Replace(fString, "'" & keywords(i) & "'", "'" & keyreplace(i) & "'", 1, -1, 1)
        fString = Replace(fString, "'" & keywords(i) & " ", "'" & keyreplace(i) & " ", 1, -1, 1)
        fString = Replace(fString, " " & keywords(i) & "'", " " & keyreplace(i) & "'", 1, -1, 1)

        fString = Replace(fString, """" & keywords(i) & """", """" & keyreplace(i) & """", 1, -1, 1)
        fString = Replace(fString, """" & keywords(i) & " ", """" & keyreplace(i) & " ", 1, -1, 1)
        fString = Replace(fString, " " & keywords(i) & """", " " & keyreplace(i) & """", 1, -1, 1)

        fString = Replace(fString, "(" & keywords(i) & ")", "(" & keyreplace(i) & ")", 1, -1, 1)
        fString = Replace(fString, "(" & keywords(i) & " ", "(" & keyreplace(i) & " ", 1, -1, 1)
        fString = Replace(fString, " " & keywords(i) & ")", " " & keyreplace(i) & ")", 1, -1, 1)

        fString = Replace(fString, "[" & keywords(i) & "]", "[" & keyreplace(i) & "]", 1, -1, 1)
        fString = Replace(fString, "[" & keywords(i) & " ", "[" & keyreplace(i) & " ", 1, -1, 1)
        fString = Replace(fString, " " & keywords(i) & "]", " " & keyreplace(i) & "]", 1, -1, 1)

        'This line needs repeated parsing misses every other word when a word is repeated
        fString = Replace(fString, " " & keywords(i) & " ", " " & keyreplace(i) & " ", 1, -1, 1)

        'scenario - first word in line
        fString = Replace(fString, chr(13) & chr(10) & keywords(i) & " ", chr(13) & chr(10) & keyreplace(i) & " ", 1, -1, 1)

        'scenario - last word in line
        fString = Replace(fString, " " & keywords(i) & chr(13) & chr(10), " " & keyreplace(i) & chr(13) & chr(10), 1, -1, 1) 

        'scenarion - first and only word in line  
        fString = Replace(fString, chr(13) & chr(10) & keywords(i) & chr(13) & chr(10), chr(13) & chr(10) & keyreplace(i) & chr(13) & chr(10), 1, -1, 1) 
    
        'scenario - first word in line followed by a character 
        fString = Replace(fString, chr(10) & keywords(i) & ".", chr(10) & keyreplace(i) & ".", 1, -1, 1)
        fString = Replace(fString, chr(10) & keywords(i) & ",", chr(10) & keyreplace(i) & ",", 1, -1, 1)
        fString = Replace(fString, chr(10) & keywords(i) & "?", chr(10) & keyreplace(i) & "?", 1, -1, 1)
        fString = Replace(fString, chr(10) & keywords(i) & "!", chr(10) & keyreplace(i) & "!", 1, -1, 1)     
        fString = Replace(fString, chr(10) & keywords(i) & ":", chr(10) & keyreplace(i) & ":", 1, -1, 1)
        fString = Replace(fString, chr(10) & keywords(i) & ";", chr(10) & keyreplace(i) & ";", 1, -1, 1)
        fString = Replace(fString, chr(10) & keywords(i) & """", chr(10) & keyreplace(i) & """", 1, -1, 1)
        fString = Replace(fString, chr(10) & keywords(i) & "'", chr(10) & keyreplace(i) & "'", 1, -1, 1)
        fString = Replace(fString, chr(10) & keywords(i) & ")", chr(10) & keyreplace(i) & ")", 1, -1, 1)
        fString = Replace(fString, chr(10) & keywords(i) & "]", chr(10) & keyreplace(i) & "]", 1, -1, 1)
          
    next
    set objRegex = nothing

    ChkKeys = fString
End Function

Sub LoadKeywordApps()
    dim strPath,xmlDoc,strErr,NumOfKeys,strKeys,strReplace,iKey
    
    strPath = "<b><font color="green">Absolute address of your Xml file</font id="green"></b>"
    set xmlDoc=CreateObject("Microsoft.XMLDOM")
    xmlDoc.async="false"
    xmlDOc.setProperty "ServerHTTPRequest", true
    xmlDoc.load(strPath)

    if xmlDoc.parseError.errorCode <> 0 Then
        strErr = "<div><b>" & vbNewLine & _
                 "<ul>" & vbNewLine & _
                 "<li>ERROR!</li>" & vbNewLine & _
                 "<li>XML File " & strFileName & " - Failed to validate.</li>" & vbNewLine & _
                 "<li>" & xmlDoc.parseError.reason & "</li>" & vbNewLine & _
                 "<li>Error code: " & xmlDoc.parseError.errorCode & "</li>" & vbNewLine & _
                 "<li>Line: " & xmlDoc.parseError.line & "</li>" & vbNewLine & _
                 "<li>Character: " & xmlDoc.parseError.linepos & "</li>" & vbNewLine & _
                 "<li>Source: " & Chr(34) & xmlDoc.parseError.srcText & Chr(34) & "</li>" & vbNewLine & _
                 "<li>" & Now & "</li>" & vbNewLine & _
                 "</ul>" & vbNewLine & _
                 "</b></div>" & vbNewLine 

        Response.Write strErr
        Response.End
    end if

    set xmlKeyList = xmlDoc.getElementsByTagName("key")

    NumOfKeys = ((xmlKeyList.length) - 1)   '0 based

    strKeys = ""
    strReplace = ""

    for iKey = 0 to cLng(NumOfKeys)
        if strKeys = "" then
            strKeys = xmlKeyList.item(iKey).childNodes(0).text
            strReplace = "<a <b><font color="red">id=""keywords""</font id="red"></b> href=""" & xmlKeyList.item(iKey).childNodes(1).text & """ target=""blank"">"
            strReplace = strReplace & xmlKeyList.item(iKey).childNodes(0).text & "</a>"
        else
            strKeys = strKeys & "," & xmlKeyList.item(iKey).childNodes(0).text
            strReplace = strReplace & ", <a <b><font color="red">id=""keywords""</font id="red"></b> href=""" & xmlKeyList.item(iKey).childNodes(1).text & """ target=""blank"">"
            strReplace = strReplace & xmlKeyList.item(iKey).childNodes(0).text & "</a>"
        end if
    next

    set xmlDoc = nothing

    Application.Lock
    Application(strCookieURL & "STRKEYWORDS") = strKeys
    Application(strCookieURL & "STRKEYREPLACE") = strReplace
    Application.UnLock
End Sub

The part in <b><font color="green">green</font id="green"></b> has to be replaced with the <b><u>absolute path</u></b> to your xml file. <b><u>The whole address</u></b>.
The part in <b><font color="red">red</font id="red"></b> adds some style to the links so they will stand out from other links. If your not interested in that just omit the parts in <b><font color="red">red</font id="red"></b>.</li>
<li>Add this line to the files you want to keywords
Dim ShowKeyWords : ShowKeyWords = True
Somewhere after <font color="red"><%</font id="red">. In "topic.asp" I added it after these lines
%>
<!--#INCLUDE FILE="config.asp"-->
<%
<font color="red">Dim ShowKeyWords : ShowKeyWords = True</font id="red">
</li>
<li>
You only need this part if want to add style to your links.
Open "inc_header.asp" and find this line
".spnSearchHighlight {background-color:" & strSearchHiLiteColor & "}" & vbNewLine & _
Add this line right after that
"#keywords{color:yellow;font-weight:bold;background-color:yellow;)" & vbNewLine & _
</li></ul>Thats it.

Three problems I encountered.
1. An ampersand in the url caused a xml parsing error, so you need to replace it with "& amp;" (without the space).
2. <s>The css class won't trump the existing class, i.e. color and text-decoration.</s> Updated with Bobbys id fix.
3. If the keyword is in a hyperlink it will mess up the link.
<ul>
<li>
<u>Updated: 5/29</u> - Links now open in new windows
css bug fixed
xml bug fixed
<s>add a file exclude list to the function</s> Reworked excludes update 6/9
</li>
<li>
<u>Update 5/30</u> - "word within word" <s>and "link within link"</s> bug fixed (theres still problems with links)
</li>
<li>
<u>Update 6/9</u> - Reworked excludes so hopefully it works for everyone.
Moved chkKeys() call to the top of formatStr() to check for carrage returns, line feeds before they are replaced.
Added more checks to catch more words.
</li>
</ul>

15   L A T E S T    R E P L I E S    (Newest First)
Webbo Posted - 23 October 2011 : 12:25:20
Good point
Carefree Posted - 23 October 2011 : 10:33:12
Just to keep dimensioned variables together, easier to eliminate repeats.
Webbo Posted - 23 October 2011 : 04:24:27
Why move code around and into the config.asp file when it worked well as is?
Just curious
Carefree Posted - 22 October 2011 : 20:56:44
Here's a "Readers Digest Condensed Book" version of this thread:


Notes:

1.	In "config.asp":

After this line (appx 473):

strShowQuickReply = Application(strCookieURL & "STRSHOWQUICKREPLY")

Insert the following:

'	##	Keywords Below
IKey = Application(strCookieURL & "IKey")
KeyReplace = Application(strCookieURL & "KeyReplace")
KeyWords = Application(strCookieURL & "KeyWords")
NumOfKeys = Application(strCookieURL & "NumOfKeys")
ObjRegex = Application(strCookieURL & "ObjRegex")
ShowKeyWords = Application(strCookieURL & "ShowKeyWords")
strErr = Application(strCookieURL & "strErr")
strKeys = Application(strCookieURL & "strKeys")
strPath = Application(strCookieURL & "strPath")
strReplace = Application(strCookieURL & "strReplace")
XMLDoc = Application(strCookieURL & "XMLDoc")
'	##	Keywords Above


After this line (appx 163):

Dim SubCount, MySubCount

Insert the following:

'	##	Keywords Below
Dim IKey, KeyReplace, Keywords, NumOfKeys, objRegex, ShowKeyWords
Dim strErr, strKeys, strPath, strReplace, xmlDoc
'	##	Keywords Above


2.	In "topic.asp" (and in any other file you wish the keyword links to function):

Before this line (appx 95):

'## Forum_SQL - Get original topic and check for the Category, Forum or Topic Status and existence

Insert the following:

'	##	Keywords Below
ShowKeyWords = True
'	##	Keywords Above

3.	In "inc_func_common.asp":

After these lines (appx 1560-1562):

Sub WriteFooterShort() %>
<!--#INCLUDE FILE="inc_footer_short.asp"-->
<% end sub

Insert the following:

'	##	Keywords Below
Function ChkKeys(fString)
	If ShowKeyWords = FALSE Then
		ChkKeys = fString
		Exit Function
	End If
	If mLev < 3 Then
		If trim(Application(strCookieURL & "STRKEYWORDS")) = "" or trim(Application(strCookieURL & "STRKEYREPLACE")) = "" Then
			LoadKeywordApps
		End If
	Else
		LoadKeywordApps
	End If
	If fString = "" or IsNull(fString) Then
		fString = " "
	End If
	keywords = split(strKeys, ",")
	keyreplace = split(strReplace, ",")
	Set objRegex = new RegExp
	objRegex.ignorecase = TRUE
	objRegex.global = TRUE
	For i = 0 to ubound(keywords)
		strPattern = "^(" & keywords(i) & ")(\s)"
		strReplace = keyreplace(i) & "$2"
		objRegex.pattern= strPattern
		fString = objRegex.replace(fString,strReplace)
		strPattern = "(" & keywords(i) & ")$"
		strReplace = keyreplace(i)
		objRegex.pattern= strPattern
		fString = objRegex.replace(fString,strReplace)
		fString = Replace(fString, " " & keywords(i) & " ", " " & keyreplace(i) & " ", 1, -1, 1)
		fString = Replace(fString, " " & keywords(i) & ",", " " & keyreplace(i) & ",", 1, -1, 1)
		fString = Replace(fString, " " & keywords(i) & ".", " " & keyreplace(i) & ".", 1, -1, 1)
		fString = Replace(fString, " " & keywords(i) & ":", " " & keyreplace(i) & ":", 1, -1, 1)
		fString = Replace(fString, " " & keywords(i) & ";", " " & keyreplace(i) & ";", 1, -1, 1)
		fString = Replace(fString, " " & keywords(i) & "!", " " & keyreplace(i) & "!", 1, -1, 1)
		fString = Replace(fString, " " & keywords(i) & "?", " " & keyreplace(i) & "?", 1, -1, 1)
		fString = Replace(fString, "-" & keywords(i) & "-", "-" & keyreplace(i) & "-", 1, -1, 1)
		fString = Replace(fString, "-" & keywords(i) & " ", "-" & keyreplace(i) & " ", 1, -1, 1)
		fString = Replace(fString, " " & keywords(i) & "-", " " & keyreplace(i) & "-", 1, -1, 1)
		fString = Replace(fString, "_" & keywords(i) & "_", "_" & keyreplace(i) & "_", 1, -1, 1)
		fString = Replace(fString, "_" & keywords(i) & " ", "_" & keyreplace(i) & " ", 1, -1, 1)
		fString = Replace(fString, " " & keywords(i) & "_", " " & keyreplace(i) & "_", 1, -1, 1)
		fString = Replace(fString, "'" & keywords(i) & "'", "'" & keyreplace(i) & "'", 1, -1, 1)
		fString = Replace(fString, "'" & keywords(i) & " ", "'" & keyreplace(i) & " ", 1, -1, 1)
		fString = Replace(fString, " " & keywords(i) & "'", " " & keyreplace(i) & "'", 1, -1, 1)
		fString = Replace(fString, """" & keywords(i) & """", """" & keyreplace(i) & """", 1, -1, 1)
		fString = Replace(fString, """" & keywords(i) & " ", """" & keyreplace(i) & " ", 1, -1, 1)
		fString = Replace(fString, " " & keywords(i) & """", " " & keyreplace(i) & """", 1, -1, 1)
		fString = Replace(fString, "(" & keywords(i) & ")", "(" & keyreplace(i) & ")", 1, -1, 1)
		fString = Replace(fString, "(" & keywords(i) & " ", "(" & keyreplace(i) & " ", 1, -1, 1)
		fString = Replace(fString, " " & keywords(i) & ")", " " & keyreplace(i) & ")", 1, -1, 1)
		fString = Replace(fString, "[" & keywords(i) & "]", "[" & keyreplace(i) & "]", 1, -1, 1)
		fString = Replace(fString, "[" & keywords(i) & " ", "[" & keyreplace(i) & " ", 1, -1, 1)
		fString = Replace(fString, " " & keywords(i) & "]", " " & keyreplace(i) & "]", 1, -1, 1)
		fString = Replace(fString, " " & keywords(i) & " ", " " & keyreplace(i) & " ", 1, -1, 1)
		fString = Replace(fString, chr(13) & chr(10) & keywords(i) & " ", chr(13) & chr(10) & keyreplace(i) & " ", 1, -1, 1)
		fString = Replace(fString, " " & keywords(i) & chr(13) & chr(10), " " & keyreplace(i) & chr(13) & chr(10), 1, -1, 1)
		fString = Replace(fString, chr(13) & chr(10) & keywords(i) & chr(13) & chr(10), chr(13) & chr(10) & keyreplace(i) & chr(13) & chr(10), 1, -1, 1)
		fString = Replace(fString, chr(10) & keywords(i) & ".", chr(10) & keyreplace(i) & ".", 1, -1, 1)
		fString = Replace(fString, chr(10) & keywords(i) & ",", chr(10) & keyreplace(i) & ",", 1, -1, 1)
		fString = Replace(fString, chr(10) & keywords(i) & "?", chr(10) & keyreplace(i) & "?", 1, -1, 1)
		fString = Replace(fString, chr(10) & keywords(i) & "!", chr(10) & keyreplace(i) & "!", 1, -1, 1)
		fString = Replace(fString, chr(10) & keywords(i) & ":", chr(10) & keyreplace(i) & ":", 1, -1, 1)
		fString = Replace(fString, chr(10) & keywords(i) & ";", chr(10) & keyreplace(i) & ";", 1, -1, 1)
		fString = Replace(fString, chr(10) & keywords(i) & """", chr(10) & keyreplace(i) & """", 1, -1, 1)
		fString = Replace(fString, chr(10) & keywords(i) & "'", chr(10) & keyreplace(i) & "'", 1, -1, 1)
		fString = Replace(fString, chr(10) & keywords(i) & ")", chr(10) & keyreplace(i) & ")", 1, -1, 1)
		fString = Replace(fString, chr(10) & keywords(i) & "]", chr(10) & keyreplace(i) & "]", 1, -1, 1)
	Next
	Set objRegex = Nothing
	ChkKeys = fString
End Function

Sub LoadKeywordApps()
	strPath = strForumURL & "keywords.xml"
	Set xmlDoc=CreateObject("Microsoft.XMLDOM")
	xmlDoc.async="False"
	xmlDOc.setProperty "ServerHTTPRequest", True
	xmlDoc.load(strPath)
	If xmlDoc.parseError.errorCode <> 0 Then
		strErr = "<div><b>" & vbNewLine & _
		"<ul>" & vbNewLine & _
		"<li>ERROR!</li>" & vbNewLine & _
		"<li>XML File " & strFileName & " - Failed to validate.</li>" & vbNewLine & _
		"<li>" & xmlDoc.parseError.reason & "</li>" & vbNewLine & _
		"<li>Error code: " & xmlDoc.parseError.errorCode & "</li>" & vbNewLine & _
		"<li>Line: " & xmlDoc.parseError.line & "</li>" & vbNewLine & _
		"<li>Character: " & xmlDoc.parseError.linepos & "</li>" & vbNewLine & _
		"<li>Source: " & Chr(34) & xmlDoc.parseError.srcText & Chr(34) & "</li>" & vbNewLine & _
		"<li>" & Now & "</li>" & vbNewLine & _
		"</ul>" & vbNewLine & _
		"</b></div>" & vbNewLine 
		Response.Write strErr
		Response.End
	End If
	Set xmlKeyList = xmlDoc.getElementsByTagName("key")
	NumOfKeys = ((xmlKeyList.length) - 1)
	strKeys = ""
	strReplace = ""
	For iKey = 0 to cLng(NumOfKeys)
		If strKeys = "" Then
			strKeys = xmlKeyList.item(iKey).childNodes(0).text
			strReplace = "<a id=""keywords"" href=""" & xmlKeyList.item(iKey).childNodes(1).text & """ target=""blank"">"
			strReplace = strReplace & xmlKeyList.item(iKey).childNodes(0).text & "</a>"
		Else
			strKeys = strKeys & "," & xmlKeyList.item(iKey).childNodes(0).text
			strReplace = strReplace & ", <a id=""keywords"" href=""" & xmlKeyList.item(iKey).childNodes(1).text & """ target=""blank"">"
			strReplace = strReplace & xmlKeyList.item(iKey).childNodes(0).text & "</a>"
		End If
	Next
	Set xmlKeyList = Nothing
	Set xmlDoc = Nothing
	Application.Lock
	Application(strCookieURL & "STRKEYWORDS") = strKeys
	Application(strCookieURL & "STRKEYREPLACE") = strReplace
	Application.UnLock
End Sub
'	##	Keywords Above

Next, within "FormatStr" function: 

After this line (appx 117):

	on Error resume next

Insert the following:

	'	##	Keywords Below
	If fString <> "Reply_MemberSig" and fString <> "Topic_MemberSig" Then
		fString = ChkKeys(fString)
	End If
	'	##	Keywords Above

4.	keywords.xml file (You'll have to create this yourself, the file name must match the one above in green save to forum root directory):

		NOTES:	
		
			a.	Pattern is critical, nothing extra can be inserted.  
			b.	If the URL is not within your forum, use the entire path (including http://),
					if it is within your forum, just the internal address is sufficient (eg. topic.asp?topic_id=300)
			c.	If a phrase is repeated within a longer phrase (eg. "murder" and "mass murder"), then list the
					longer phrase keyword first or the shorter recognized keyword will point both to the first URL.

<?xml version="1.0" encoding="ISO-8859-1"?>
	<keywords>
		<key>
			<phrase>xml</phrase>
			<url>http://some/site.xml</url>
		</key>
		<key>
			<phrase>html</phrase>
			<url>http://some/site.html</url>
		</key>
		<key>
			<phrase>css</phrase>
			<url>http://some/site.css</url>
		</key>
	</keywords>

Styling (optional):  To add a style to the keyword links, make the following changes.

In "inc_header.asp", look for this line (appx 269):

".spnSearchHighlight {background-color:" & strSearchHiLiteColor & "}" & vbNewLine & _

After that, insert these:

		"#keywords {color:" & strLinkColor & "; font-weight:normal; text-decoration:none; border-bottom-style:1px dashed; line-height:18px;}" & vbNewLine & _
		"#keywords:hover {color:" & strHoverFontColor & "; font-weight:normal; text-decoration:none; border-bottom-style:1px dashed; line-height:18px;}" & vbNewLine & _


Note: I modified this to move all dimensioned variables into "config.asp" from "inc_func_common.asp", etc.
bobby131313 Posted - 13 August 2008 : 19:47:00
I would appear you're correct. <
Andy Humm Posted - 13 August 2008 : 18:38:58
Ditto: On my forum, a user initiated link does override the auto link. I didn't do anything different that what was provided in this thread.<
bobby131313 Posted - 13 August 2008 : 18:31:24
Really? Hmmm... let me investigate, it's been a little while since I played with it.<
leatherlips Posted - 13 August 2008 : 18:21:51
quote:
Originally posted by bobby131313

Awesome crypto, thanks!

I think the only thing left is the conflict of a user initiated link and a keyword link. Obviously I would like a user initiated link to override an automated link.

That doesn't sound to my amateur mind like it would be easy though.

On my forum, a user initiated link does override the auto link. I didn't do anything different that what was provided in this thread.<
Carefree Posted - 13 August 2008 : 18:12:42
I never did get the KW working properly. Disabled it and went on to other things.<
bobby131313 Posted - 13 August 2008 : 18:07:50
Awesome crypto, thanks!

I think the only thing left is the conflict of a user initiated link and a keyword link. Obviously I would like a user initiated link to override an automated link.

That doesn't sound to my amateur mind like it would be easy though. <
Andy Humm Posted - 13 August 2008 : 17:33:57
Leatherlips, thank you for the PM, regarding dynamic signatures... Allow Dynamic Signatures -makes it work.. Thank You Andy<
leatherlips Posted - 13 August 2008 : 14:13:40
No. I meant:

'if trim(Application(strCookieURL & "STRKEYWORDS")) = "" or trim(Application(strCookieURL & "STRKEYREPLACE")) = "" then
	LoadKeywordApps
'end if


Unless you replaced that with cripto9t's code:

if mLev < 3 then
    if trim(Application(strCookieURL & "STRKEYWORDS")) = "" or trim(Application(strCookieURL & "STRKEYREPLACE")) = "" then
	LoadKeywordApps
    end if
else
    LoadKeywordApps
end if
<
Andy Humm Posted - 13 August 2008 : 13:53:21
Did you reload the keywords? - I assume you mean upload the xml again, if yes, I have done that but still the same?<
leatherlips Posted - 13 August 2008 : 09:56:44
Those changes look right to me. Did you reload the keywords?<
Andy Humm Posted - 13 August 2008 : 03:45:23
Quote: Do you think there is a way to have this not work in members signatures? Some of my members use key words and phrases in their signatures and I would like for them to not have the auto links.
I looked at this and a quick solution would be to add an unmodified "formatStr" function to "inc_func_common" and rename it "formatStr2". Then find the sigs part in "topic.asp" and rename it there. Remember 2 sigs, one for the topic and one for the replies.

I have added a new unmodified "formatStr" as "formatStr2" and I think I have amended the right reply sig's but the sig block still shows the keyword links
This is my formatstr2
function FormatStr2(fString)
on Error resume next
fString = Replace(fString, CHR(13), "")
'fString = Replace(fString, CHR(10) & CHR(10), "<br /><br />")
fString = Replace(fString, CHR(10), "<br />")
if strBadWordFilter = 1 or strBadWordFilter = "1" then
fString = ChkBadWords(fString)
end if

if strAllowForumCode = "1" then
fString = ReplaceURLs(fString)
fString = ReplaceCodeTags(fString)
if strIMGInPosts = "1" then
fString = ReplaceImageTags(fString)
end if
end if

fString = ChkURLs(fString, "http://", 1)
fString = ChkURLs(fString, "https://", 2)
fString = ChkURLs(fString, "www.", 3)
fString = ChkMail(fString)
fString = ChkURLs(fString, "ftp://", 5)
fString = ChkURLs(fString, "file:///", 6)

if strIcons = "1" then
fString = smile(fString)
end if
if strAllowForumCode = "1" then
fString = extratags(fString)
end if
FormatStr2 = fString
on Error goto 0
end function


And the two sig amendments are at lines 692 -698
		Response.Write	"</span id=""msg""></font></td>" & vbNewLine & _
" </tr>" & vbNewLine
if CanShowSignature = 1 and Reply_Sig = 1 and Reply_MemberSig <> "" then
Response.Write " <tr>" & vbNewLine & _
" <td valign=""bottom""><hr noshade size=""" & strFooterFontSize & """><font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><span class=""spnMessageText"">" & formatStr2(Reply_MemberSig) & "</span></font></td>" & vbNewLine & _
" </tr>" & vbNewLine
end if

and lines 918 -924
Response.Write	"</span id=""msg""></font></td>" & vbNewLine & _
" </tr>" & vbNewLine
if CanShowSignature = 1 and Topic_Sig = 1 and Topic_MemberSig <> "" then
Response.Write " <tr>" & vbNewLine & _
" <td valign=""bottom""><hr noshade size=""" & strFooterFontSize & """><font color=""" & strForumFontColor & """ face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><span class=""spnMessageText"">" & formatStr2(Topic_MemberSig) & "</span></font></td>" & vbNewLine & _
" </tr>" & vbNewLine
end if


Are these code changes the right ones?<

Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000 Version 3.4.07