圖片內(nèi)容頁(yè)修改為顯示所有圖片并加入分頁(yè)功能(2)_動(dòng)易Cms教程
教程Tag:暫無Tag,歡迎添加,賺取U幣!
dim PicID,PicUrl,PicNum,n,sql,Rs,PicUrl_1,PicUrl_2 ’要害內(nèi)容從這里開始
PicID=request("PicID") ’獲取頁(yè)面請(qǐng)求的圖片ID
sql="select * from PE_Photo where PhotoID = " &PicID ’尋找數(shù)據(jù)庫(kù)中相匹配的數(shù)據(jù)
set Rs = Server.CreateObject("ADODB.Recordset")
Rs.open sql,conn,1,1
PicUrl=split(rs("PhotoUrl"),"$$$") ’將從表中得到的PhotoUrl用$$$分隔開,存到PicUrl數(shù)組中,形如array(圖片
地址1|a.jpg,圖片地址2|b,jpg,圖片地址3|c,jpg)
PicNum=UBound(PicUrl) ’返回PicUrl數(shù)組的最大可用下標(biāo)( 1即得到圖片張數(shù))
’response.write "第" & PicID & "一共有" & PicNum 1 & "張圖片〈br〉"
for n=0 to PicNum ’從第一個(gè)圖片開始,循環(huán)顯示
PicUrl_1=split(trim(PicUrl(n)),"|") ’再次將 圖片地址2|b,jpg 拆分為兩部分,得到圖片的地址
if UBound(PicUrl_1)=0 then ’判定地址前面有沒有"圖片地址1"等說明,沒有則加上“圖片”字樣
PicUrl_2=Array("圖片",PicUrl_1(0))
else
PicUrl_2 =PicUrl_1
end if ’ 將整理后的第N張圖片的說明及地址存到數(shù)組PicUrl_2中
if left(PicUrl_2(1),7) = "http://" then ’簡(jiǎn)單判定站內(nèi)地址還是站外地址
else
PicUrl_2(1) = "UploadPhotos/" & PicUrl_2(1) ’這里請(qǐng)改為你photo下面上傳文件的文件夾
end if
response.write "〈table
response.write "〈tr〉〈td
response.write "〈td align=center〉〈img src=’" & PicUrl_2(1) & "’ class=’pic’ border=0 onscroll=’bbimg(this)’
onload=’resizepic(this)’〉" ’顯示圖片的html代碼,可自己添加超級(jí)鏈接等
response.write "〈br〉〈br〉第 〈font color=’red’〉" & n 1 & "〈/font〉 張圖片:" & PicUrl_2(0) & "〈/td〉"
’:圖片及說明
response.write "〈td
response.write "〈tr〉〈td
next
Rs.close
set Rs = nothing
%〉
2.修改圖片內(nèi)容頁(yè)模板
查找{$ViewPhoto}標(biāo)簽,替換為