Inserir próxima página e página anterior em um código já pronto
Olá,
Galera não entendo nada de ASP, estou fazendo o reedesign de um site e como o site é antigo não consigo contato com o programador.
O lance é o seguinte, o código já está funcionando porem preciso criar um << Anterior e Next>> na navegação da paginação do Recordset oRs.
Olhei alguns códigos aki, mas não consegui adaptar.
Segue o código eu preciso inserir um Página anterior e próxima página quem puder ajudar eu agradeço boa sorte e sucesso sempre.
<%
option explicit
%>
<!--#include file="lib/site.asp" -->
<!--#include file="lib/util.asp" -->
<%
DIM oRs, oRs2, oConn, strSQL
DIM i, dia, mes, ano, noticiaID
DIM PaginaAtual, TotalPaginas, PaginaDe
DIM PaginaAte, Contador
DIM intpagina, pg,vPageSize
DIM TotalRegistros
vPageSize = 10
noticiaID = Request.QueryString("noticiaID")
Call page_load()
strSQL = "SELECT * FROM noticias WHERE categoria = 1 ORDER BY noticiaID DESC"
oRs.open strSQL, oConn, 1
If noticiaID <> "" Then
strSQL = "SELECT * FROM noticias WHERE noticiaID ="& noticiaID
Else
strSQL = "SELECT * FROM noticias WHERE categoria = 1 ORDER BY noticiaID DESC "
End If
oRs2.open strSQL, oConn, 1
'Paginação de Dados
If Not oRs.EOF Then
PaginaAtual = Request("pg")
If Not ereg("^[0-9]+$", PaginaAtual) Then
PaginaAtual = 1
End If
PaginaAtual = CInt(PaginaAtual)
If PaginaAtual = 0 Then PaginaAtual = 1
If Not oRs.EOF Then
oRs.PageSize = 1
oRs.CacheSize = 1
oRs.AbsolutePage = PaginaAtual
TotalPaginas = oRs.PageCount
TotalRegistros = oRs.RecordCount
End If
PaginaDe = PaginaAtual - 2
PaginaAte = PaginaAtual + 2
If PaginaDe < 1 Then PaginaDe = 1
If PaginaAte > TotalPaginas Then PaginaAte = TotalPaginas
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="[http://www.w3.org/1999/xhtml">](http://www.w3.org/1999/xhtml)
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<div id="menulateral">
<ul>
<li><strong>Últimas Notícias</strong></li><%
contador = 0
Do While not oRs.eof AND contador <= 4
ano = year(oRs("data"))
dia = day(oRs("data"))
mes = Month(oRs("data"))
contador = contador + 1
Print "<li><a href='noticias.asp?noticiaID="& oRs("noticiaID") &"' class='link3'><span class='linknews'>"& dia &"."& mes &"."& ano &"</span> - "& oRs("chamada") &"</a></li>"
Print ""
oRs.MoveNext
Loop
oRs.close
%>
<% If TotalPaginas > 1 Then %>
<!--Página <%=PaginaAtual%> de <%=TotalPaginas%>.-->
<%For Contador = PaginaDe To PaginaAte%>
<%'If Contador = PaginaAtual Then%>
<%' Print "<span class='link2'>. <b>Contador</b></span>"%>
<%'Else%>
<a href="<%=AspSelf()%>?noticiaID=<%=noticiaID%>&pg=<%=Contador%>" class="link2"><%=Contador%></a> <%'End If%>
<%Next%>
<% End If %>
</ul>
</div>
<div id="conteudotextos">
<strong><%= oRs2("titulo")%></strong>
<strong><%= oRs2("texto")%></strong>
<%
If oRs2("imagem") <> "" Then
Print "<tr>"
Print"<td valign='top' class='fonte'><img src=""../images/"& oRs2("imagem") & """ width='360'></td>"
Print "</tr>"
End If
%>
</div>
</body>
</html>
<% call page_unload() %>Discussão (2)
Carregando comentários...