日期:2011-08-16  浏览次数:20901 次

刚写的,能执行但没有整理,如果看例子就看WWW.HIFI-CHINA.COM中的显示的文章。图片做到随机定位,切满足不同的对齐、边框、图注要求。并带有UBB支持模块,但在这里去掉了:)

<SCRIPT LANGUAGE=VBscript RUNAT=Server>

function getarticle(articleid,showtitle,prubb)
showpicture=true
articletext=""
set articledbc = server.createobject("adodb.command")
set ars = server.createobject("adodb.recordset")
ars.open "select * from article_comm where article_id=" & articleid,session("ds"),1,1
if not ars.eof then
article_id=ars("article_id")
article_title=rtrim(ars("title"))
article_comm=server.htmlencode(ars("comm"))
article_date=datevalue(ars("adddate"))
ars.close
articledbc.ActiveConnection=session("ds")
articledbc.commandtext="UPDATE article_comm SET showcounter = showcounter + 1, lastread = GETDATE() WHERE (article_id = " & article_id & ")"
articledbc.execute
if showpicture then
ars.open "SELECT article_pic.article_id, article_pic.pic_id, article_pic.loctrate, article_pic.align,  article_pic.show_sq, article_pic.style, PicLab.picurl, PicLab.pic_sq, PicLab.pic_comm,  PicLab.pic_linkout FROM article_pic INNER JOIN PicLab ON article_pic.pic_id = PicLab.pic_id where (article_id = " & article_id & ") order by loctrate",session("ds"),1,1
dim addpic()
dim toarticle()
redim addpic(ars.recordcount -1)
redim toarticle(ars.recordcount)

for i = 1 to ars.recordcount
addpictemp=""

    thepoint=clng(cdbl(ars("loctrate"))* (1-lastloctrate) * len(article_comm))
    lastloctrate=cdbl(ars("loctrate"))
    toarticle(i-1)=left(article_comm,thepoint)
    article_comm=right(article_comm,len(article_comm)-thepoint)
    select case ars("align")
    case 0
addpictemp= addpictemp + "<div align=""center"">"
addpictemp= addpictemp + "<center>"
addpictemp= addpictemp + "<table border=""0"" cellpadding=""0"" cellspacing=""0"" "
if ars("style")=2 then
addpictemp= addpictemp + "style=""border-collapse: collapse; border-style: solid; border-width: 1"" bordercolor=""#111111"" "
end if
addpictemp= addpictemp + ">"
addpictemp= addpictemp + "<tr>"
addpictemp= addpictemp + "<td width=""100%"">"
addpictemp= addpictemp + "<div align=""center"">"
addpictemp= addpictemp + "<center>"
addpictemp= addpictemp + "<table  width=""32"" height=""32"" cellpadding=""0"" cellspacing=""0"" "
if ars("style")=0 then
addpictemp= addpictemp + "style=""border-collapse: collapse; border-style: solid; border-width: 1"" bordercolor=""#111111"" "
end if
addpictemp= addpictemp + ">"
addpictemp= addpictemp + "<tr>"
addpictemp= addpictemp + "<td align=""center"">"
addpictemp= addpictemp + "<img border=""0"" "

if ars("show_sq") =2 or ars("show_sq") =3 then
addpictemp= addpictemp + " title=""" + server.htmlencode(ars("pic_comm")) +""" "
end if
addpictemp= addpictemp +" src="""
addpictemp= addpictemp + SESSION("Image_lab") +"/"+rtrim(ars("