integrare script per paginazione ad una pagina asp

sara80

Nuovo Utente
21 Mag 2007
24
0
0
ciao a tutti!
dovrei integrare questo script:

Codice:
<div align="center">
	 <table width="100%" border="0:106" cellspacing="0" style="border-left-width: 0px; border-right-width: 0px">
<%
'---Dichiarazione variabili
	Dim SQL, RSnews, CicloNews,page, perpage,Rs,i,pag
		'recupero la pagina 
		page = Request.QueryString("page") 
		
		perpage = 1

	Set Conn = Server.CreateObject("ADODB.Connection") 
	Conn.open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("/mdb-database/ecom.mdb") 
	Set Rs = Server.CreateObject("ADODB.Recordset") 
	SQL = " SELECT * FROM News ORDER BY ID ASC"
	Rs.Open sql, Conn, 1, 3 
If page = "" then 
page = (rs.PageCount) 
End if 

Rs.PageSize = perpage 
Rs.AbsolutePage = page %>



   <tr bgcolor="">
<td  width="239" style="border-bottom-style: solid; border-bottom-width: 1px">
				

<img border="0]<%=Path_Img%>news.jpg" width="100:80">
			
				
			

<td  width="238" style="border-bottom-style: solid; border-bottom-width: 1px">
				 
<%= RS("Titolo")%><tr>

				
<td width="11" align="center" valign="top" 
bordercolor="#D9E7EE" style="border-left-style: none; border-left-width: medium; border-right-style:none; 
border-right-width:medium; border-top-style:solid; border-top-width:1px:73">
					
					
<%=RS("Img")%>



				
</td>

				
<td width="100%"  valign="top" bordercolor="#D9E7EE" style="border-left-style: none; border-left-width: medium; 
border-right-style:none; border-right-width:medium; border-top-style:solid; border-top-width:1px:73">
					 
<%= RS("Testo")%></td>

		
		


			
		


	</table></div>

<%
For i = 1 to perpage 
If Not Rs.EOF then 
if Rs("id") < 10 then 
end if 
Rs.MoveNext 
end if 
next %>
<% 

Response.Write "<P><B>Pagine News Presenti:</B> " 

For pag= 1 to rs.PageCount 
if page = pag then 
Response.Write "<b>" 
Response.Write "<A href='default.asp?page=" & pag 
Response.write "'>" 
Response.Write pag 
Response.Write "</A> " 
Response.Write "</b>" 
else 
Response.Write "<A href='default.asp?page=" & pag 
Response.write "'>" 
Response.Write pag 
Response.Write "</A> " 
end if 
Next 

Response.Write "</P>" %>


<%
Rs.Close 
Set Rs = Nothing 
Conn.Close 
Set Conn = Nothing 
%>

in questa pagina asp che così com è già mi stampa a video i record presi da una variabile MaxNews contenuta in un file include inc_variabili.asp:

Codice:
<table width="480" border="0" align="center" height="344">
<%
'---Dichiarazione variabili
	Dim SQL, RSnews, CicloNews

'---Recupero le ultime News dal database e le stampo a video
	Set RSnews = Server.CreateObject("ADODB.RecordSet")
	SQL = " SELECT * FROM News ORDER BY ID DESC"
	RSnews.Open SQL, Conn, 1

	If NOT RSNews.EOF Then
		For CicloNews = 1 To MaxNews
			If RSNews.EOF Then Exit For
%>
		<tr bgcolor="<%=Tabella_Colore_Titolo%>">
			<td colspan="2">
				<b>  &gt; <%= RSnews("Titolo") %></b>
			</td>
		</tr>
		<tr>
<%
			If Len(RSnews("Img")) > 0 Then
%>
				<td width="120" align="center" valign="top">
					<img src="<%=Path_Img%><%=RSnews("Img")%>" width="110" height="108" border="1">
				</td>
				<td width="360" valign="top">
<%
			Else
%>
				<td width="480" valign="top" colspan=2>
<%
			End If
%>
				<p align="justify"><%= RSnews("Testo") %> </p>
			</td>
		</tr>
<%
				RSnews.MoveNext
		Next
        Else
%>
		<tr>
			<td align="center" valign="top" colspan="2">
				<%=Errore_NoNews%>
			</td>
		</tr>
<%
        End If

        RSNews.Close
	Set RSnews = Nothing
%>
	</table>


praticamente integrarlo a (For CicloNews = 1 To MaxNews) dove MaxNews è = al num di record per pagina..per fare l impaginazione..chi mi da una mano a farlo o a capire come si fa?

grazie
 

sara80

Nuovo Utente
21 Mag 2007
24
0
0
impostando così lo script funziona tutto correttamente come potete vedere al link: http://www10.asphost4free.com/aspasp/news.asp

Non funziona soltanto la variabile MaxNews inclusa nella pagina news.asp così:

<!--#include virtual="aspasp/mdb-database/inc_variabili.asp"-->

nel file inc_variabili.asp è settato così:

Codice:
<%

'FILE DI CONFIGURAZIONE DELLE VARIABILI GLOBALI

Dim MaxNews

'#Configurazione news
MaxNews = 2  'Numero di news visualizzati in home page

e si dovrebbero visualizzare 2 record per pagina...
Dovrei integrare la variabile MaxNews in questa pagina asp chi mi da una mano?

Codice:
<%
	'VERSIONE FILE 1.4.0
%>

<div align="justify">
		
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;news.<br><br><br>
  </div>
	<table width="480" border="1" align="center" height="150" cellpadding="3" cellspacing="1">
<%
'---Dichiarazione variabili
	Dim SQL, RSnews, CicloNews, page, perpage, Rs, i, pag
		'recupero la pagina 
		page = Request.QueryString("page") 
		
		perpage = 1

	Set Conn = Server.CreateObject("ADODB.Connection") 
	Conn.open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("/aspasp/mdb-database/ecom.mdb") 
	Set Rsnews = Server.CreateObject("ADODB.Recordset") 
	SQL = " SELECT * FROM News ORDER BY ID ASC"
	RSnews.Open SQL, Conn, 1 
If page = "" then 
page = (rsnews.PageCount) 
End if 

Rsnews.PageSize = perpage 
Rsnews.AbsolutePage = page 
%>
		<tr bgcolor="<%=Tabella_Colore_Titolo%>">
			<td colspan="2">
				<b>&nbsp; <%= RSnews("Titolo") %></b>
			</td>
		</tr>
		<tr>
<%
			If Len(RSnews("Img")) > 0 Then
%>
				<td width="120" align="center" valign="top">
					<a href="" target="_blank"><img src="<%=RSnews("Img")%>" alt="" width="80" height="83" border="1"></a>
				</td>
				<td width="21000" valign="top">
<%
			Else
%>
				<td width="480" valign="top" colspan=2>
<%
			End If
%>
				<p align="justify"><%= RSnews("Testo") %>&nbsp;</p>
			</td>
		</tr>
<%
				RSnews.MoveNext
		'Next
        'Else
%>		
		
</table>
<%
For i = 1 to perpage 
If Not Rsnews.EOF then 
if Rsnews("id") < 10 then 
end if 
Rsnews.MoveNext 
end if 
next 
%>

<% 

Response.Write "<P><B>Pagine News Presenti:</B> " 

For pag= 1 to rsnews.PageCount 
if page = pag then 
Response.Write "<b>" 
Response.Write "<A href='news.asp?page=" & pag 
Response.write "'>" 
Response.Write pag 
Response.Write "</A> " 
Response.Write "</b>" 
else 
Response.Write "<A href='news.asp?page=" & pag 
Response.write "'>" 
Response.Write pag 
Response.Write "</A> " 
end if 
Next 

Response.Write "</P>" %>


<%
Rsnews.Close 
Set Rsnews = Nothing 
Conn.Close 
Set Conn = Nothing 
%>
<br>
<table width="96" border="0" align="right">
                  <tr>
                    <th height="18" class="sm Stile2  Stile5" scope="col"><span class="sm  big Stile6"><span class="sm  big Stile7"><span class="sm  big"><a href="javascript:history.back(-1);">indietro</a><a href="javascript:history.back(-1);"><img src="<%=Path_Img%>catalogo_indietro.gif" alt="<%=TestoIndietro%>" width="18" height="21" border="0"></a></span></span></span></th>
                  </tr>
            </table>
 

sara80

Nuovo Utente
21 Mag 2007
24
0
0
impostando

'#Configurazione news
MaxNews = 2 'Numero di news visualizzati in home page

e

codice:

Codice:
'---Dichiarazione variabili
	Dim SQL, RSnews, CicloNews, page, perpage, Rs, i, pag
		'recupero la pagina 
		page = Request.QueryString("page") 
		
		perpage = [B]MaxNews[/B]



ora mi visualizza 2 page al posto di 4 ma sempre una table per pagina e non due table...

come potete vedere al link: http://www10.asphost4free.com/aspasp/news.asp
 
Ultima modifica:

sara80

Nuovo Utente
21 Mag 2007
24
0
0
si esatto, ma richiamando una variabile che è contenuta nel file:
"aspasp/mdb-database/inc_variabili.asp"

la MaxNews

mi servirebbe quel tipo di script che mi richiama le voci dal db di questo tipo:

ad es: <%= Rs("Titolo") %>
 
Ultima modifica:

sara80

Nuovo Utente
21 Mag 2007
24
0
0
si..non ricevo errori è solo che mi visualizza sempre 1 riga del database, anche se gli metto MaxNews = 2 che significa 2 righe per pagina..
 
Discussioni simili
Autore Titolo Forum Risposte Data
Emix Problema nell'integrare uno script ad un altro esisnte... Ajax 2
Monital Integrare il mio script a joomla Joomla 2
H Integrare script php in script php? PHP 78
P Script da integrare in vBulletin PHP 0
V [JAVA] come integrare un software scritto in java su una pagina web? Java 4
W Integrare Javascript in PHP PHP 14
M [WordPress] [HTML] INTEGRARE GESTIONALE IMMOBILIARE SU UN SITO WEB DA FARE WordPress 0
F Integrare I Post Di Wordpress.com In Una Pagina HTML WordPress 2
P [HTML] integrare Google pagina web HTML e CSS 5
otto9due Form personalizzato in bootstrap da integrare nel tema wordpress WordPress 0
C Come posso integrare il bottone "paga adesso" di paypal e un form php per invio dati? PHP 1
ecosito Integrare i post di Wordpress.com in una pagina HTML HTML e CSS 1
K Integrare player per streaming mss:// nella mia App Sviluppo app per Android 0
C Integrare sito html e Joomla Joomla 8
S integrare diversi tipi di pagamento in un sito web, e convalidare l' iscrizione PHP 8
voldemort Integrare moduli in R in un simulatore Java Java 1
T Integrare AdMob dentro app Android Sviluppo app per Android 2
T Integrare bottone stampa in app Android Sviluppo app per Android 1
S integrare RSS tramite codice - no tool esterni Javascript 4
P Integrare php con java PHP 20
V integrare php/mysql con pagine html/css PHP 7
F integrare/collegare twitter al proprio sito PHP 1
W Non riesco a integrare php con html PHP 1
Frank10 Non so come integrare una slideshow di immagini HTML e CSS 2
F Codice invio sms da integrare PHP 1
R integrare paginazione PHP 13
R Integrare (in modo completo) un blog in Wordpress con Facebook WordPress 2
S Integrare forum in pagina html HTML e CSS 0
V Ragazzi ho bisogno di un aiuto - integrare news in un sito - CMS (Content Management System) 5
M Integrare un cms al proprio sito web CMS (Content Management System) 3
M integrare un'applicazione fatta da me in joomla Joomla 3
K modulo invio mai:l non riesco ad integrare captcha PHP 18
S Integrare Wordpress HTML e CSS 0
C integrare 123flaschat in drupal CMS (Content Management System) 7
C integrare flash con stile mootools Flash 1
C integrare il database con fronypage? Database 1
W integrare fancybox e php PHP 4
catellostefano Integrare joomla a WHMCS Joomla 2
catellostefano integrare phpbb con joomla Joomla 7
G non riesco ad integrare l’interprete php nel server Apache su Vista PHP 2
catellostefano Integrare net2ftp_v0.97 su joomla Joomla 0
T [ADOdb] Integrare più funzioni con una sola form PHP 1
D Integrare Flash con ...... Flash 1
B Integrare Asp/html Per Le Select Classic ASP 0
G Integrare una pagina html in una pagina asp ??? Classic ASP 1
F Somma di più tabelle da script Javascript 0
L Script per convertire numeri in parole Javascript 2
H Eliminazione script. Photoshop 0
S Script Google Translate scomparso HTML e CSS 3
P lanciare script asp (o php) da jquery Javascript 1

Discussioni simili