Hi folks,
I have made some addition to the forum by making a new tag when posting/editing. It makes a textarea. It works ok, but I am not sure how to code it for the occurance of more than one textarea in the same post.
I now take the fString and split it into three parts. Part two being the part of the string from <textarea and until /textarea> which then is NOT parsed by:
fString = Replace(fString, CHR(10) & CHR(10), "</p><p> ") or
fString = Replace(fString, CHR(10), " <br />")
while the other 2 parts of the string IS parsed by these. I then put the three parts together again.
Obviously this makes only room for one textarea in each post, and my problem is then about how I code this for multiple occurances of such an area. The code I have at this point looks like this. I use code33 to recognice a textarea being posted: ( in inc_func_common.asp)
function FormatStr(fString)
on Error resume next
fString = " " & fString
fString = Replace(fString, CHR(13), "")
If Instr(fString,"id=""code33""") = 0 Then
fString = Replace(fString, CHR(10) & CHR(10), "</p><p> ")
end if
If Instr(fString,"id=""code33""") = 0 Then
fString = Replace(fString, CHR(10), " <br />")
else
findarea=instr(fString,"<text") ' Finds beginning
del_en=mid(fString,1,findarea-1) ' First part
restentmp=trim(mid(fString,findarea)) ' the rest
findneste=instr(restentmp,"</textarea>") 'Finds the end of textarea
mitArea=mid(restentmp,1,findneste+10) ' textarea part
restentmp=mid(restentmp,findneste+11) ' Last part
' Parses first and third part
del_en = Replace(del_en, CHR(10) & CHR(10), "</p><p> ")
del_en = Replace(del_en, CHR(10), " <br />")
restentmp = Replace(restentmp, CHR(10) & CHR(10), "</p><p> ")
restentmp = Replace(restentmp, CHR(10), " <br />")
' joins the three parts together again
fString= del_en + mitArea + restentmp
Any tips on how I make a loop to go through the fString, finding unknown occurances of textareas? Parsing everything but the texarea and then joins the parts together again? The reason for not parsing the text inside the textarea is that the tags <br />, </p>, <p> will otherwise show in there. Any help on this is appreciated.
Regards
Arne