View Full Version : html enteties
darktown
10-29-2004, 06:47 AM
The idea:
---------
an input textarea or textbox.
for example the value of the textbox is :
[ u r l] http://www.myurl.com [/u r l ]
I insert into my database : "[u r l ]http://www.myurl.com[/ u r l]"
When i retrieve it from my database i do this :
Dim message As String = sdr.GetString(3)
message = message.Replace("[ u r l ]", "<a href='")
message = message.Replace("[/ u r l]", "'></a>")
but i do not get html when i show the variable message, it doesn't show the content at all. It only shows Anybody an idea of how i can show html that i get from the database.
thx
entimp
10-29-2004, 06:57 AM
Still New to ASP but wouldn't it be something like:
Response.Write("<a href=""" & message & """ target=""_self"">message</a>")
darktown
10-29-2004, 07:06 AM
yep, stuuuuuuuuupid fault of me!!
message = message.Replace("", "<a href='")
message = message.Replace("", "'></a>")
Where to click on to test?? :p
there isn't anything between <a>to click on..</a>
darktown
10-29-2004, 07:29 AM
if i want to use [u r l] [Y] and many others isn't there a shorter way to write this than (check with an array or so?) :
Dim message As String = sdr.GetString(3)
Dim i1 As Int16 = message.IndexOf("")
Dim i2 As Int16 = message.IndexOf("")
Dim lenght As Int16 = i2 - i1
Dim link As String = message.Substring(i1, lenght)
link = link.Replace("", "")
link = link.Replace("", "")
link = "' target='new'>" & link & "</a>"
message = message.Replace("", "<a href='")
message = message.Replace("", link)
afterburn
10-29-2004, 10:40 AM
Originally posted by darktown
The idea:
---------
an input textarea or textbox.
for example the value of the textbox is :
[ u r l] http://www.myurl.com [/u r l ]
I insert into my database : "[u r l ]http://www.myurl.com[/ u r l]"
When i retrieve it from my database i do this :
Dim message As String = sdr.GetString(3)
message = message.Replace("[ u r l ]", "<a href='")
message = message.Replace("[/ u r l]", "'></a>")
but i do not get html when i show the variable message, it doesn't show the content at all. It only shows Anybody an idea of how i can show html that i get from the database.
thx
If your using .net then stop that with recreating the string. in .net creating a string then over writting the value multiple times means that the string will be created reallocated then the pointer will be moved to the located needed.
Use the Class StringBuilder, its faster...
darktown
10-29-2004, 02:30 PM
thx for the tip
i'll adjust it and post it if it works ;)
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.