Forums
This topic is locked
Stripping html tags ?
Posted 09 Jan 2003 10:02:35
1
has voted
09 Jan 2003 10:02:35 Nathan Pollux posted:
hi guysi've written some kind of news-module which has a summary of the three latest newsitems on the main page. So it displays the date, followed by the 30-40 first char's of the content field with a ReadMore link. This is all working perfectly.
The only problem i have is that i use a online html editor the add the content. Using css makes the font and fontsize ok but bold and italic txt is displayed as bold and italic txt. Links are displayed aswell.
This is logical ofcourse but is there any way with which i can strip out the html tags from the field to display it as plain txt ?
Maybe a DMX extention of do i have to use <font face='Arial'><font color=red>Replace(Field,"some tag",""</font id=red></font id='Arial'> for each html tag ?
any suggestions ?
cheers
Nos
-------------------------------------------------------------------
I scream in dev/null so nobody can hear me being frustrated.
Replies
Replied 09 Jan 2003 13:31:48
09 Jan 2003 13:31:48 Owen Eastwick replied:
Try something like:
<%
varText = Request("TextAreaName"
varHTMLarray = Array("<head>","</head>","<body>","</body>","<table>","</table>" ' <font color=red><--- Put all the tags you want to strip out in the list.</font id=red>
For i = 0 to Ubound(varHTMLarray)
varText = Replace(varText, varHTMLarray(i), ""
Next
%>
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
Edited by - oeastwick on 09 Jan 2003 13:39:27
<%
varText = Request("TextAreaName"
varHTMLarray = Array("<head>","</head>","<body>","</body>","<table>","</table>" ' <font color=red><--- Put all the tags you want to strip out in the list.</font id=red>
For i = 0 to Ubound(varHTMLarray)
varText = Replace(varText, varHTMLarray(i), ""
Next
%>
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
Edited by - oeastwick on 09 Jan 2003 13:39:27
Replied 09 Jan 2003 16:41:12
09 Jan 2003 16:41:12 Nathan Pollux replied:
oeastwick,
thanks man, that was exactly what i was looking for !
but i'm not that skilled yet with arrays so i would have never thought of that, i think i would have gotten a zillion 'replace' commands in my code if i didn't post this question ...
thanks again!
Nos
-------------------------------------------------------------------
I scream in dev/null so nobody can hear me being frustrated.
thanks man, that was exactly what i was looking for !
but i'm not that skilled yet with arrays so i would have never thought of that, i think i would have gotten a zillion 'replace' commands in my code if i didn't post this question ...
thanks again!
Nos
-------------------------------------------------------------------
I scream in dev/null so nobody can hear me being frustrated.