关于数据库中文章排版的问题?

想问一下,从数据库中读取的文章要对它进行排版,该怎么办?我现在的用的办法是在文章录入时插入一些html标记,但是这样的话太麻烦了,不知有没有很快捷的方法?
---------------------------------------------------------------

數據寫入數據庫前,用下面代碼替換一些字符.
content=replace(content,"&","&")
content=replace(content,"<","<")
content=replace(content,">",">")
content=replace(content,"chr(60)","<")
content=replace(content,"chr(37)",">")
content=replace(content,"""",""")
content=replace(content,chr(13),"

1<br/>

" & chr(13)+chr(10))
content=replace(content,chr(32)," ")
顯示時,調用RS("COUNT")就可以了.
---------------------------------------------------------------

没有
楼上的方法应该和你的一样吧?
---------------------------------------------------------------

 1   
 2function htmlencode2(str)   
 3dim result   
 4dim l   
 5if isNULL(str) then   
 6htmlencode2=""   
 7exit function   
 8end if   
 9l=len(str)   
10result=""   
11dim i   
12for i = 1 to l   
13select case mid(str,i,1)   
14case "<"   
15result=result+"<"   
16case ">"   
17result=result+">"   
18case chr(13)   
19result=result+"

``` " case chr(34) result=result+""" case "&" result=result+"&" case chr(32) 'result=result+" " if i+1<=l and i-1>0 then if mid(str,i+1,1)=chr(32) or mid(str,i+1,1)=chr(9) or mid(str,i-1,1)=chr(32) or mid(str,i-1,1)=chr(9) then result=result+" " else result=result+" " end if else result=result+" " end if case chr(9) result=result+" " case else result=result+mid(str,i,1) end select next htmlencode2=result end function
1显示是调用```
2=Rs("htmlencode2")
Published At
Categories with Web编程
Tagged with
comments powered by Disqus