Sorta complicated, I only want to replace text if two things exist, <%= and %>, and on each separate account also...
For example, if I have the following code:
<%
'stuff here
%>
The stuff is <%=here%> <-there
The outcome would be:
<%
'stuff here
%>
The stuff is " & here & " <-there
I have the following function to do this, BUT it also replaces %> that exist in other places, and I dont want it to do that. I remember seeing something on 4guys about this but hell if I could find it again. The concept this is based on is a response.writer. I know they already exist, but they either suck, or arent for distribution. This one is going to be for free distribution, so webmasters can use them on there own site.
Here's the function that processes the string... It dosnt insert the response.writes yet, but I was going to have it do that after it filters everything else
Function ProcessScript(stringdata)
if Trim(stringdata) = "" then
Exit Function
end if
te = stringdata
repstr1 = Chr(34) & "<" & Chr(37) & "="
repstr1a = String(3, 34) & " & "
repstr2 = Chr(37) & ">" & Chr(34)
repstr2a = strReverse(repstr1a)
repstr3 = "<" & Chr(37) & "="
repstr3a = Chr(34) & " & "
repstr4 = Chr(37) & ">"
repstr4a = strReverse(repstr3a)
te = replace(te, repstr1, repstr1a, 1, -1, 1)
te = replace(te, repstr2, repstr2a, 1, -1, 1)
te = replace(te, repstr3, repstr3a, 1, -1, 1)
te = replace(te, repstr4, repstr4a, 1, -1, 1)
ProcessScript = te
End Function
----
-Eric (da_stimulator)
Stims Snitz Test area - Running 3.3.03, 4 beta, Huw's code, and Davio's code
Need a Mod? Check out the Mod Resource