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 & _