Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

cacuba

Problemas na paginação

Recommended Posts

Fiz uma lojinha virtual e usei um exemplo de paginação que encontrei nesse endereço:

http://www.codefixer.com/codesnippets/recordsetpaging.asp

 

Está dando erros e não consigo achar a solução, ou fazer uma condição que faça tudo funcionar.

 

Os erros estão nas paginas:

http://www.multienfeites.com.br/loja/lista..._id=9&PageNo=22

http://www.multienfeites.com.br/loja/lista..._id=14&PageNo=3

http://www.multienfeites.com.br/loja/lista..._id=17&PageNo=3

 

Agradeço desde já quem puder me ajudar.

 

Att.

 

Caio da Cunha

 

__________________________________________

 

O meu codigo ficou assim:

 

<%lista=Request.querystring("lista")cat_id = Request.querystring("cat_id")subcat_id = Request.querystring("subcat_id")if isempty(subcat_id) then 	subcat_id = Request.querystring("cat_id") end ifcat_nome=Request.querystring("cat_nome")nome=Request.querystring("nome")%><div id="produto"><p> <br><strong>Subcategorias</strong></p>		 <% set ver_subs = lojaDB.Execute("SELECT * FROM subcategorias where cat_id =" & request("cat_id") & " order by id")			if ver_subs.eof then 			Response.Write("<strong><font color=red>Nenhuma subcategoria cadastrada</font></strong>")			else %>			<% While not ver_subs.EOF  %>		 	- <a href="listaprod.asp?lista=categoria&cat_id=<%=ver_subs("cat_id")%>&subcat_id=<%=ver_subs("id")%>"><%=ver_subs("nome") %></a><br />			<%		 				ver_subs.movenext				Wend 				end if%>		</div>		<% if request("cat_id") = 6 then %><!--#include file="msg_esculturas.asp"--><% end if %><div id="divisao_home"></div><%If IsEmpty(Request.Querystring("PageNo")) thenCurrPage = 1ElseCurrPage = Cint(Request.Querystring("PageNo"))End If Function getNext10(num)pageLen = len(num)If pageLen = 1 Thennext10 = 10Else If pageLen>1 ThenpageRem = 10pageTen = right(num, 1)next10 = num + pageRem - pageTenEnd IfEnd IfgetNext10 = next10End FunctionFunction getPrev10(num)pageLen = len(num)If pageLen = 1 thenprev10 = 1Else If pageLen>1 thenlastNumber = right(num, 1)prev10 = num - lastNumber - 10End IfEnd IfIf prev10 = 0 thenprev10 = 1End IfgetPrev10 = prev10End FunctionSet lista_produtos = Server.CreateObject("ADODB.Recordset")set lista_produtos.activeconnection = lojaDBsql = "SELECT * FROM produtos WHERE cat_id="& cat_id &" and subcat_id="& subcat_id &" AND disp='S' ORDER BY nome"lista_produtos.CursorLocation = 3lista_produtos.open sqllista_produtos.PageSize = 3if lista_produtos.eof or lista_produtos.bof then   response.write "O banco de dados está vazio"else	lista_produtos.AbsolutePage = CurrPagenext10 = getNext10(CurrPage)prev10 = getPrev10(CurrPage)   contador = 0   conta_divisor = 1   Do Until lista_produtos.AbsolutePage <> CurrPage OR lista_produtos.Eof%>		<div id="produto">			<a href="descri.asp?prod=<%= lista_produtos("id") %>&cat=<%= lista_produtos("cat_id") %>">			<img src="imagens/produtos/pequenas/<%= lista_produtos("imagem") %>" />			<h2><%= lista_produtos("nome") %></h2>			<h3><%= lista_produtos("codigo") %></h3></a>			<!--<h2>R$ <% '= lista_produtos("preco") %></h2> -->		</div>		<% if conta_divisor <= 2 then %>				<div id="divisao_home"></div>		<% else 		   end if    contador = contador + 1   conta_divisor = conta_divisor + 1   lista_produtos.movenext   loopend if'Criando links para a navegação%><%RSPrevPage = CurrPage -1RSNextPage = CurrPage + 1If Next10 > lista_produtos.PageCount ThenNext10 = lista_produtos.PageCountEnd IfIf prev10 = 1 AND next10 - 1 < 10 Thenstart = 1Elsestart = Next10 - 10If right(start, 1) > 0 Thenstart = replace(start, right(start, 1), "0")start = start + 10End IfEnd If%></div><div id="naveg_pag"><%'This checks to make sure that there is more than one page of resultsIf lista_produtos.PageCount > 1 Thenresponse.write ("<strong>Páginas: </strong>")'Work out whether to show the Previous 10 '<<' 	If next10 > 10 Then	response.write("<a href=""listaprod.asp?cat_id="& lista_produtos("cat_id") &"&subcat_id="& lista_produtos("subcat_id") &"&PageNo=" & Prev10 & """> << </a> ")	End If'Work out whether to show the Previous link '<' 	If NOT RSPrevPage = 0 then	response.write("<a href=""listaprod.asp?cat_id="& lista_produtos("cat_id") &"&subcat_id="& lista_produtos("subcat_id") &"&PageNo=" & RSPrevPage & """><</a> ")	End If		'Loop through the page number navigation using P as our loopcounter variable 	For P = start to Next10		If NOT P = CurrPage then		response.write("| <a href=""listaprod.asp?cat_id="& lista_produtos("cat_id") &"&subcat_id="& lista_produtos("subcat_id") &"&PageNo=" & P & """>" & P & "</a> ")		Else		'Don't hyperlink the current page number 		response.write("| <strong style=color:#5B2C9B>" & P & " </strong>")		End If	Next'this does the same as the "previous" link, but for the "next" link	If NOT RSNextPage > lista_produtos.PageCount Then	response.write("| <a href=""listaprod.asp?cat_id="& lista_produtos("cat_id") &"&subcat_id="& lista_produtos("subcat_id") &"&PageNo=" & RSNextPage & """>></a> ")	End If'Work out whether to show the Next 10 '>>' 	If NOT Next10 = lista_produtos.PageCount Then	response.write("<a href=""listaprod.asp?cat_id="& lista_produtos("cat_id") &"&subcat_id="& lista_produtos("subcat_id") &"&PageNo=" & Next10 & """>>></a>")	End If		else	response.write ("")End If' Close the recordset and connection object%><div id="superior"><%'This checks to make sure that there is more than one page of resultsIf lista_produtos.PageCount > 1 Thenresponse.write ("<strong>Páginas: </strong>")'Work out whether to show the Previous 10 '<<' If next10 > 10 Thenresponse.write("<a href=""listaprod.asp?cat_id="& lista_produtos("cat_id") &"&subcat_id="& lista_produtos("subcat_id") &"&PageNo=" & Prev10 & """><<</a> ")End If'Work out whether to show the Previous link '<' If NOT RSPrevPage = 0 thenresponse.write("<a href=""listaprod.asp?cat_id="& lista_produtos("cat_id") &"&subcat_id="& lista_produtos("subcat_id") &"&PageNo=" & RSPrevPage & """><</a> ")End If'Loop through the page number navigation using P as our loopcounter variable For P = start to Next10If NOT P = CurrPage thenresponse.write("| <a href=""listaprod.asp?cat_id="& lista_produtos("cat_id") &"&subcat_id="& lista_produtos("subcat_id") &"&PageNo=" & P & """>" & P & "</a> ")Else'Don't hyperlink the current page number response.write("| <strong style=color:#5B2C9B>" & P & " </strong>")End IfNext'this does the same as the "previous" link, but for the "next" linkIf NOT RSNextPage > lista_produtos.PageCount Thenresponse.write("| <a href=""listaprod.asp?cat_id="& lista_produtos("cat_id") &"&subcat_id="& lista_produtos("subcat_id") &"&PageNo=" & RSNextPage & """>></a> ")End If'Work out whether to show the Next 10 '>>' If NOT Next10 = lista_produtos.PageCount Thenresponse.write("<a href=""listaprod.asp?cat_id="& lista_produtos("cat_id") &"&subcat_id="& lista_produtos("subcat_id") &"&PageNo=" & Next10 & """>>></a>")End Ifelse	response.write ("")End If' Close the recordset and connection objectlista_produtos.Close Set lista_produtos = NothinglojaDb.Close%></div></div>

Compartilhar este post


Link para o post
Compartilhar em outros sites

o que tem na linha??/loja/paging.asp, line 177

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.