eventually:
Im using version 7.9 still so line numbers may differ for V8.x or V9.x
at the top of forum_posts.asp add in the following (just below "<!--#include file="includes/emoticons_inc.asp" -->" on or about line 8 (my code has been tweaked that:
<% Function EncodeEbayHyperlinks(inText) Dim objRegExp, strBuf, ebayAffiliateURL Dim objMatches, objMatch Dim Value, ReplaceValue, iStart, iEnd
ebayAffiliateURL = "http://rover.ebay.com/rover/1/711-1751-2978-71/1?AID=5463217&PID=2399323&mpre=" strBuf = "" iStart = 1 iEnd = 1 Set objRegExp = New RegExp objRegExp.Pattern = "\b(http\://stores.ebay\.|http\://www.ebay\.|http\://cgi\.ebay\.|stores.ebay\.)\S+\b" objRegExp.IgnoreCase = True ' Set case insensitivity. objRegExp.Global = True ' Set global applicability. Set objMatches = objRegExp.Execute(inText) For Each objMatch in objMatches iEnd = objMatch.FirstIndex strBuf = strBuf & Mid(inText, iStart, iEnd-iStart+1) strBuf = strBuf & ebayAffiliateURL & replace(Server.UrlEncode(objMatch.Value), "%26amp%3B", "%26") iStart = iEnd+objMatch.Length+1 Next strBuf = strBuf & Mid(inText, iStart) EncodeEbayHyperlinks = strBuf Set objRegExp = Nothing End Function %>
|
On line 854 (of my modded code!) before the following block of code:
Response.Write(vbCrLf & " </td>" & _ vbCrLf & " </tr>" & _ vbCrLf & " <tr>" & _ vbCrLf & " <td colspan=""2""><hr /></td>" & _ vbCrLf & " </tr>" & _ vbCrLf & " </table>" & _ vbCrLf & "<!-- Message body -->" & vbCrLf & strMessage & vbCrLf & "<!-- Message body ''"""" -->" & _ etc. |
add the following:
'###################################################### '#### ebay link hack '######################################################
strmessage = EncodeEbayHyperlinks(strMessage)
|
Points to note:
* My code has been modified so line numbers are not accurate
* The variable named ebayAffiliateURL holds my ebay affiliate link is in red - replace it with yours or else i will earn your commission (if any!)
* As I previously said, this is for WWF version 7.9 - check the code in version 8 onwards for compatibility - maybe someone will be able to show correct line numbers.
* this doesn't change text before it is inserted into the database - it replaces text before after it is selected out and served in the HTML to the user.
* how it works: the function is called via the line
strmessage = EncodeEbayHyperlinks(strMessage)
with the entire message as an argument for the function.
The function uses VBScript regular expressions to find references of the following:
http://stores.ebay.
http://www.ebay.
http://cgi.ebay.
stores.ebay.
(note that the '.' and ':' are escaped using a backslash (\))
Once these are found within your message the enay affiliate part of the link is placed in front of it.
If you have any queries about this, just post them here.
Oh and despite all the hassle of creating this, I have made (so far) a measly UK£0.41