Har ett nyhetsscript med bilduppladdning. Som det är nu så visas alla bilder i slutet av sidan. Nu tänkte jag att man skulle kunna placera in bilderna vart som helst i nyheten genom att typ skriva "[bild1]", "[bild2]" osv.
Men om man vill ha bilden i nyheten så ska den ju inte visas i slutet.
Function myReplace(ByVal strText, ByVal strReplace, ByVal strReplaceWith, ByRef blnReplaced)
blnReplaced = false
if instr(strText, strReplace) > 0 then blnReplaced = true
myReplace = replace (strText, strReplace, strReplaceWith)
End function
texten = myReplace(RS("text"), "[bild1]", "<img src=""bild1.asp"" border=""0"">", replaced)
If replaced then
' det har replaceats!
else
' nähä :-(
end if
Det går också att lösa med RegExp, men sånt kan inte jag. ;)