图片代码调用问题
以下代码是图片管理程序中显示图片(这段是显示所有类别的图片)的代码, 然后我想根据分类,调用单独的一类图片放在首页. 哪位帮帮忙,调用代码是什么样的,急~!~!`<%
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if rs.bof and rs.eof then
rsclose()
connclose()
'------------->如果没有记录则关闭数据库的连接(BOF为真值)
Response.Write("<br><br><br><br><center>对不起。没有相关图片!</center>")
else
PageShowSize = 10
MyPageSize = img
If Not IsNumeric(Request.querystring("page")) Or IsEmpty(Request.querystring("page")) Or Request.querystring("page") <=0 Then
MyPage=1
Else
MyPage=Int(Abs(Request.querystring("page")))
End if
rs.pagesize=mypagesize
maxpages=rs.pagecount
rs.absolutepage=mypage
total=rs.recordcount
Response.Write("<P align=center><table width=90% cellspacing=""4"" cellpadding=""4"">")
do while not rs.eof
response.write"<tr>"
for i=1 to cel
img=rs("news_content")
if instr(img,"[img]") then
img = Replace(img, "[img]", "<img src=")
img = Replace(img, "[/img]", " border=1 style='border-color:#4286E7' alt='点击看详细资料' width=100 height=100 >")
else
img = Replace(img, "[uploadimg]", "<img src=upload/")
img = Replace(img, "[/uploadimg]", " border=1 style='border-color:#4286E7' alt='点击看详细资料' width=100 height=100 >")
end if
Response.Write("<td align=center width=160\>")
Response.Write("<table width=97% border=0 cellspacing=""0"" cellpadding=""0""\><tr><td background=""images/bj.jpg"" height=""22"" valign=middle align=center><font color=white>"&rs("title")&"</font></td></tr><tr><td valign=middle align=center>")
Response.Write("<a href=view.asp?id="&rs("id")&" target=_blank>"&img&"")
Response.Write("<br><br>" & rs("title") & "</a></td></tr></table></td>")
rs.movenext
if rs.eof or i=MyPageSize then '------>这句一定要加上。当指针指向最后一个记录时。则退出循环
exit do '------>但是发现一个问题。当只有两个图片时,而将每页显示一个
end if '------>图片,这时页面会显示两张图片,为了避免这种情况,所以加了一句
next '------->if i=MyPageSize then exit do 这样就可以避免失误了。^!^
response.write "</tr>"
j=j+1
if j=rows then exit do '------------>如果j=rows数刚退出循环
loop
response.write "</table>"
PageNextSize=int((MyPage-1)/PageShowSize)+1
Pagetpage=int((total-1)/rs.PageSize)+1
if PageNextSize >1 then
PagePrev=PageShowSize*(PageNextSize-1)
Response.write "<a href='" & Url & "&page=" & PagePrev & "'><font face=webdings>9</font></a> "
'Response.write "<a href='" & Url & "&page=1' title='第1页'>页首</a> "
end if
if MyPage-1 > 0 then
Prev_Page = MyPage - 1
Response.write "<a href='" & Url & "&page=" & Prev_Page & "'><font face=webdings>7</font></a> "
end if
if Maxpages>=PageNextSize*PageShowSize then
PageSizeShow = PageShowSize
Else
PageSizeShow = Maxpages-PageShowSize*(PageNextSize-1)
End if
If PageSizeShow < 1 Then PageSizeShow = 1
for PageCounterSize=1 to PageSizeShow
PageLink = (PageCounterSize+PageNextSize*PageShowSize)-PageShowSize
if PageLink <> MyPage Then
Response.write "<a href='" & Url & "&page=" & PageLink & "'>[" & PageLink & "]</a> "
else
Response.Write "<B>["& PageLink &"]</B> "
end if
If PageLink = MaxPages Then Exit for
Next
if Mypage+1 <=Pagetpage then
Next_Page = MyPage + 1
Response.write "<a href='" & Url & "&page=" & Next_Page & "'><font face=webdings>8</font></A>"
end if
if MaxPages > PageShowSize*PageNextSize then
PageNext = PageShowSize * PageNextSize + 1
'Response.write " <A href='" & Url & "&page=" & Pagetpage & "' title='第"& Pagetpage &"页'>页尾</A>"
Response.write " <a href='" & Url & "&page=" & PageNext & "'><font face=webdings>:</font></a>"
End if
rsclose()
connclose()
end if
%>