Visualizzazione dei risultati da 1 a 5 su 5
  1. #1
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560

    integrare script ad una pagina asp

    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 "
    
    Pagine News Presenti: " 
    
    For pag= 1 to rs.PageCount 
    if page = pag then 
    Response.Write "" 
    Response.Write "<A href='default.asp?page=" & pag 
    Response.write "'>" 
    Response.Write pag 
    Response.Write "</A> " 
    Response.Write "" 
    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">
    				 &gt; <%= RSnews("Titolo") %>
    			</td>
    		</tr>
    		<tr>
    <%
    			If Len(RSnews("Img")) > 0 Then
    %>
    				<td width="120" align="center" valign="top">
    					[img]<%=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?

  2. #2
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560
    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ì:



    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">
    		
    news.
    
    
    
      </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">
    				 <%= RSnews("Titolo") %>
    			</td>
    		</tr>
    		<tr>
    <%
    			If Len(RSnews("Img")) > 0 Then
    %>
    				<td width="120" align="center" valign="top">
    					http://&#91;img]<%=RSnews(&#91;/img]" alt=""...3" border="1">
    				</td>
    				<td width="21000" valign="top">
    <%
    			Else
    %>
    				<td width="480" valign="top" colspan=2>
    <%
    			End If
    %>
    				<p align="justify"><%= RSnews("Testo") %></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 "
    
    Pagine News Presenti: " 
    
    For pag= 1 to rsnews.PageCount 
    if page = pag then 
    Response.Write "" 
    Response.Write "<A href='news.asp?page=" & pag 
    Response.write "'>" 
    Response.Write pag 
    Response.Write "</A> " 
    Response.Write "" 
    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 
    %>
    
    
    <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">indietro[img]<%=Path_Img%>catalogo_indietro.gif[/img]" width="18" height="21" border="0"></span></span></span></th>
                      </tr>
                </table>

  3. #3
    codice:
    '---Dichiarazione variabili
    	Dim SQL, RSnews, CicloNews, page, perpage, Rs, i, pag
    		'recupero la pagina 
    		page = Request.QueryString("page") 
    		
    		perpage = MaxNews
    IP-PBX management: http://www.easypbx.it

    Old account: 2126 messages
    Oldest account: 3559 messages

  4. #4
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560
    impostando

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

    e

    codice:
    perpage = MaxNews
    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

  5. #5
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560
    up

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.