CurtWRC
04-28-2006, 11:18 AM
Currently I'm using about 15 different replace codes to change BBc codes to HTML tags. However this means I have to copy & paste the same code for every message input on my site to keep it consistent like so:
message.Text = Replace(message.Text, vbCrLf, "<br />")
message.Text = Replace(message.Text, "[b]", "<b>")
message.Text = Replace(message.Text, "[u]", "<u>")
message.Text = Replace(message.Text, "[i]", "<i>")
However Ive heard its possible to loop the replace code using a database. So I created a table in my database and put the BBc codes in the 'Before' field and the HTML tags in the 'After' table. However I don't have a clue how to loop this. I imagine I would put something like this in the loop:
message.text = Replace(message.Text, "Before Field", "After Field")
If anyone can help that would be much appreciated, Thanks.
message.Text = Replace(message.Text, vbCrLf, "<br />")
message.Text = Replace(message.Text, "[b]", "<b>")
message.Text = Replace(message.Text, "[u]", "<u>")
message.Text = Replace(message.Text, "[i]", "<i>")
However Ive heard its possible to loop the replace code using a database. So I created a table in my database and put the BBc codes in the 'Before' field and the HTML tags in the 'After' table. However I don't have a clue how to loop this. I imagine I would put something like this in the loop:
message.text = Replace(message.Text, "Before Field", "After Field")
If anyone can help that would be much appreciated, Thanks.