Paginazione risultati

redmilion

Nuovo Utente
16 Feb 2005
29
0
0
Buongiorno, sono a chiederVi un aiuto perche sto realizzando un sito amatoriale per la vendita di gioielli fatti a mano dalla mia fidanzata.
Si tratta di un sito in ASP che mi è stato "passato" da un amico e che sto cercando di adattare alle nostre necessità.
Io di ASP ci capisco ben poco e dovendo paginare i risultati che in ogni categoria sono decine, non so come fare.
In realtà ho già consultato dei forum e letto tutorial e non sembrerebbe una cosa difficilissima, ma ne mio caso, trattandosi di una pagina preesistente con un codice complicato non saprei dove mettere mano senza fare danni.
Qualcuno potrebbe darmi una mano e magari suggerirmi l'ottimizzazione del codice che mi sembra un labirinto?
Posto qui sotto il codice mentre la pagina attuale è visibile qui >>> http://daffodil.angelaurbani.it/categoria.asp?idcat=4&ln=it
Ringrazio anticipatamente chi vorrà aiutarmi.
Grazie
Emiliano

Codice:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<%
	'DEFINISCO IL TITOLO DELLA PAGINA
	dim ln, referer, titolo
	ln = request("ln")
	if len(ln) = 0 then ln = "it"
	
	select case ln
	
	case "it"
    titolo = "Vendita On-Line bijoux e accessori moda unici"
	
	case "en"
	titolo = "Handmade Italian bijoux online selling"

	end select
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- #include file="inc/variabili.asp" -->
<title>DAFFODIL BIJOUX - <%=titolo%></title>

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>

<%
	dim idcat
	idcat = Request("idcat")

	referer = "categoria.asp?idcat=" & idcat

    sub ScriviRisultato()

    dim cn, rs, strSQL

    set cn = Server.CreateObject("Adodb.Connection")
    cn.Open strConnect
    set rs = Server.CreateObject("Adodb.Recordset")
	
	select case ln
	
	case "it"
    strSQL = "SELECT * FROM T_prodotti where visualizza_it = true AND idcategoria =" & IDCat
	
	case "en"
    strSQL = "SELECT * FROM T_prodotti where visualizza_en = true AND idcategoria =" & IDCat

	end select
    rs.Open strSQL, cn
%>

<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="error">

<%
	if Rs.EOF then
	Response.Write "Non sono presenti prodotti in questa categoria"
	end if
%>

</td>
</tr>
<tr>
<td>
<table class="TABLEprodotti">

<%
	do while not rs.EOF
	dim nome, descrizione
	
	select case ln
	
	case "it"
	nome = rs("nome_it")
	descrizione = rs("descbreve_it")
	
	case "en"
	nome = rs("nome_en")
	descrizione = rs("descrizione_en")
	
	end select
%>

<tr>
<!-- IMMAGINE -->
<td class="TDlineDWN"><a href="prodotti.asp?idprodotto=<%=rs("idprodotto")%>&ln=<%=ln%>"><img src="/products/<%=rs("foto1")%>" width="75" border="0" align="middle" alt="Vedi dettaglio prodotto"></a></td>
<!-- DESCRIZIONE -->
<td class="TDlineDWN" height="35"><a class="titProdCat" href="prodotti.asp?idprodotto=<%=rs("idprodotto")%>&ln=<%=ln%>"><%=nome%></a>&nbsp;<br><span class="prodProd">(<%=rs("azienda")%>)</span><br><span class="prodProd"><%=descrizione%></span></td>
<!-- IMMAGINE PRICECUT -->
<td class="TDlineDWN" align="center">

<%
	if rs("prezzo") = rs("prezzoScontato") and not rs("prezzo") = 0 then
	response.Write "&nbsp;"
	elseif not rs("prezzo") = 0 then
	response.Write " <img src=""images/pricecut_PIGGY.gif"">"
	
	else
	response.Write "&nbsp;"
	end if
%>

</td>

<!-- PREZZO SE LOGATO -->
<% 
	if Len(session("id_utente")) <> 0 then 
	dim prezzo, adtochart, prezzoScontato
	
	select case ln
	
	case "it"
	adtochart = "Acquista"
	prezzo = "Prezzo"
	prezzoScontato = "Prezzo Scontato"

	case "en"
	adtochart = "Buy"
	prezzo = "Price"
	prezzoScontato = "Prezzo Scontato"

	end select
%>
<td class="TDlineDWN" align="center">
<span class="textprezzo"><%= prezzo %></span><br>

<%
	if rs("prezzo") = rs("prezzoScontato") and not rs("prezzo") = 0 then
	response.Write "<span class=""prezzo""> &euro; " & rs("prezzo") & "</span>"
	
	elseif not rs("prezzo") = 0 then
	response.Write " <span class=""pricecut""> &euro; " & rs("prezzo") & "</span><br><span class=""prezzo"">&euro;  " & rs("prezzoScontato") & "</span>"
	end if
%>

<br>
<a href="carrello.asp?id=<%=Rs("idprodotto")%>&ln=<%=ln%>" class="linkAcquista"><%=adtochart%></a>
</td>

<% else %>
<!-- PREZZO SE NON LOGATO -->
<%
	dim prezzo2, Registrandoti, prezzoScontato2
	select case ln
	
	case "it"
	prezzo2 = "Prezzo"
	Registrandoti = "Registrati"
	prezzoScontato2 = "PrezzoScontato"
	
	case "en"
	prezzo2 = "Price"
	Registrandoti = "Register to buy"
	prezzoScontato2 = "PrezzoScontato"

	end select
%>
<td class="TDlineDWN" align="center"><span class="textprezzo"><%= prezzo2 %></span><br>

<%
	if rs("prezzo") = rs("prezzoScontato") and not rs("prezzo") = 0 then
	response.Write "<span class=""prezzo""> &euro; " & rs("prezzo") & "</span>"
	
	elseif not rs("prezzo") = 0 then
	response.Write " <span class=""pricecut""> &euro; " & rs("prezzo") & "</span><BR><span class=""prezzo"">&euro;  " & rs("prezzoScontato") & "</span>"
	end if
%>
<BR>

<a href="regutente.asp?ln=<%=ln%>" class="linkRegister"><%=registrandoti%></a></TD>

<%  end if %>


</tr>

<%  
	rs.MoveNext
	loop
%>

</table>
</td>
</tr>
</table>

<%
	rs.Close
	set rs = nothing
	end sub
%>
<!-- APPLICAZIONE / FINE -->

<link href="STYLE.css" rel="stylesheet" type="text/css">

</head>

<body>
<!-- INIZIO TABELLA GENERALE -->
<table width="960" height="20" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td><!-- INCLUSIONE DELL'INTESTAZIONE (HEADER) --><!--#include virtual="inc/head.asp"--></td>
  </tr>
</table>
<table width="800" height="500" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td align="center" valign="top">

<!-- INIZIO TABELLA CONTENUTO -->
<table width="960" border="0" align="center" cellpadding="10" cellspacing="0" bgcolor="#FFFFFF">
<tr>

<!-- COLONNA SX - MENU -->
<td width="175" height="500" align="left" valign="top"><!-- #include file="inc/menusx.asp" --></td>

<!-- COLONNA CENTRALE -->
<td valign="top">

<%
	set cn = Server.CreateObject("Adodb.Connection")
	cn.Open strConnect
	set rs = Server.CreateObject("Adodb.Recordset")
	strSQL = "SELECT T_categorie.* FROM T_categorie where idcategoria = " &  idcat

	rs.Open strSQL, cn
	do while not rs.EOF
	
	select case ln
	
	case "it"
	nome = rs("nome_it")
	descrizione = rs("descrizione_it")
	
	case "en"
	nome = rs("nome_en")
	descrizione = rs("descrizione_en")

	end select
	Response.Write  "<p class=""titCat"">&raquo; " & nome & "</p>"
	Response.Write  "<p class=""content_text_red"">" & descrizione & "</p>"
	rs.MoveNext
	loop
	rs.Close 
%>

<table width="100%">
<tr>
<td colspan="5" align="center" bgcolor="#F7E1E3" class="TDNovita">
<%
	dim titoloTabella
	select case ln
	
	case "it"
	titoloTabella = "I Prodotti"
	
	case "en"
	titoloTabella = "Products"
	
	end select
%>

—&nbsp;<%=titoloTabella%>&nbsp;—</td>
</tr>                               
<tr>
<td><% ScriviRisultato() %></td>
</tr>
</table>
</td>

<!-- COLONNA DX - MENU -->
<td width="175" height="500" align="left" valign="top"><!-- #include file="inc/menudx.asp" --></td>
</tr>

</table>
<!-- FINE TABELLA CONTENUTO -->

<!-- INCLUSIONE DEL PIE PAGINA (FOOTER) -->
<!--#include virtual="inc/foot.html"-->

</body>
</html>
 

Discussioni simili