Visualizzazione dei risultati da 1 a 5 su 5
  1. #1
    Utente di HTML.it L'avatar di Girogio
    Registrato dal
    May 2007
    Messaggi
    366

    Elenco news senza tabella

    Ciao a tutti..
    ragazzi mi servirebbe un aiuto per modificare del codice asp..
    mi spiego:
    ho una pagina news.asp dove ci stanno le news prelevati da un db..
    ora ho apportato una sorta di modifica prelevando la parte di codice che conteneva la tabella che a sua volta faceva da involucro alle news..e le ho messe nella home page

    Ora per problemi di validazione ed anche di pura mia fissazione sto cercando di richiamare le news
    dal db ed inserirle nella colonna di destra con un elenco
    ossia <ul id="News">[*]Notizia1[*]Notizia2
    ma mi chiedevo:
    come posso modificare il codice asp e nn utilizzare le tabelle e poi modificare il tutto con i css...??
    nn sō se sono stato chiaro..
    posto il codice..
    codice:
    div id="box_colonna2"> 
    
       <ul id="news"> 
     
    
    <%
    Dim rsNews
    Dim rsNews_numRows
    
      Set rsNews = Server.CreateObject("ADODB.Recordset")
    rsNews.ActiveConnection = MM_News_STRING
    rsNews.Source = "SELECT * FROM news"
    rsNews.CursorType = 0
    rsNews.CursorLocation = 2
    rsNews.LockType = 1
    rsNews.Open()
    
     
    rsNews_numRows = 0
    %>
    <%
    Dim Repeat1__numRows
    Dim Repeat1__index
    
    Repeat1__numRows = -1
    Repeat1__index = 0
    rsNews_numRows = rsNews_numRows + Repeat1__numRows
    %>
    <%
    '  *** Recordset Stats, Move To Record, and Go To Record: declare stats variables
    
    Dim rsNews_total
    Dim rsNews_first
    Dim rsNews_last
    
    ' set the record count
    rsNews_total = rsNews.RecordCount
    
    ' set the number of rows displayed on this page
    If (rsNews_numRows < 0) Then
      rsNews_numRows = rsNews_total
    Elseif (rsNews_numRows = 0) Then
      rsNews_numRows = 1
    End If
    
    ' set the first and last displayed record
    rsNews_first = 1
    rsNews_last  = rsNews_first + rsNews_numRows - 1
    
    ' if we have the correct record count, check the other stats
    If (rsNews_total <> -1) Then
      If (rsNews_first > rsNews_total) Then
        rsNews_first = rsNews_total
      End If
      If (rsNews_last > rsNews_total) Then
        rsNews_last = rsNews_total
      End If
      If (rsNews_numRows > rsNews_total) Then
        rsNews_numRows = rsNews_total
      End If
    End If
    %>
    
    <%
    ' *** Recordset Stats: if we don't know the record count, manually count them
    
    If (rsNews_total = -1) Then
    
      ' count the total records by iterating through the recordset
      rsNews_total=0
      While (Not rsNews.EOF)
        rsNews_total = rsNews_total + 1
        rsNews.MoveNext
      Wend
    
      ' reset the cursor to the beginning
      If (rsNews.CursorType > 0) Then
        rsNews.MoveFirst
      Else
        rsNews.Requery
      End If
    
      ' set the number of rows displayed on this page
      If (rsNews_numRows < 0 Or rsNews_numRows > rsNews_total) Then
        rsNews_numRows = rsNews_total
      End If
    
      ' set the first and last displayed record
      rsNews_first = 1
      rsNews_last = rsNews_first + rsNews_numRows - 1
      
      If (rsNews_first > rsNews_total) Then
        rsNews_first = rsNews_total
      End If
      If (rsNews_last > rsNews_total) Then
        rsNews_last = rsNews_total
      End If
    
    End If
    %>
    
    
    <%
    Dim Repeat2__numRows
    Dim Repeat2__index
    
    Repeat2__numRows = -1
    Repeat2__index = 0
    rsNews_numRows = rsNews_numRows + Repeat2__numRows
    %>
    <%
    Dim MM_paramName 
    %>
    
    <%
    ' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
    
    Dim MM_keepNone
    Dim MM_keepURL
    Dim MM_keepForm
    Dim MM_keepBoth
    
    Dim MM_removeList
    Dim MM_item
    Dim MM_nextItem
    
    ' create the list of parameters which should not be maintained
    MM_removeList = "&index="
    If (MM_paramName <> "") Then
      MM_removeList = MM_removeList & "&" & MM_paramName & "="
    End If
    
    MM_keepURL=""
    MM_keepForm=""
    MM_keepBoth=""
    MM_keepNone=""
    
    ' add the URL parameters to the MM_keepURL string
    For Each MM_item In Request.QueryString
      MM_nextItem = "&" & MM_item & "="
      If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
        MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
      End If
    Next
    
    ' add the Form variables to the MM_keepForm string
    For Each MM_item In Request.Form
      MM_nextItem = "&" & MM_item & "="
      If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
        MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
      End If
    Next
    
    ' create the Form + URL string and remove the intial '&' from each of the strings
    MM_keepBoth = MM_keepURL & MM_keepForm
    If (MM_keepBoth <> "") Then 
      MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
    End If
    If (MM_keepURL <> "")  Then
      MM_keepURL  = Right(MM_keepURL, Len(MM_keepURL) - 1)
    End If
    If (MM_keepForm <> "") Then
      MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
    End If
    
    ' a utility function used for adding additional parameters to these strings
    Function MM_joinChar(firstItem)
      If (firstItem <> "") Then
        MM_joinChar = "&"
      Else
        MM_joinChar = ""
      End If
    End Function
    %>
    
    	
    <%
    if((rsNews_total=0)) Then
    response.Write"<p align='center'>"
    response.Write"<font face=Verdana size=2 color='#000099'>"
    response.Write("Non ci sono attualmente articoli da leggere")
    response.Write"</font>"
    response.Write"</p>"
    end if
    %>	
    
    <%
    if((rsNews_total >=1)) Then
    %>
     
     %>
      <table width="170"  cellpadding="0" cellspacing="0">
      
            <tr>
              <td colspan="3"  height="20"><span class="Stile1">Sommario 
            delle news di oggi <%=Date()%></span></td>
        </tr>
        <tr> 
          <td width="1" height="10"></td>
          <td width="1" height="10"></td>
        </tr>
        <% 
    While ((Repeat1__numRows <> 0) AND (NOT rsNews.EOF)) 
    %>
        <tr> 
          <td width="1" height="19"></td>
          <td width="398" height="19"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">"><%=(rsNews.Fields.Item("titolo").Value)%></font></td>
          <td width="1" height="19"></td>
        </tr>
        <tr> 
          <td width="1"  height="4"></td>
          <td width="398" height="4"></td>
          <td width="1" height="4"></td>
        </tr>
        <% 
      Repeat1__index=Repeat1__index+1
      Repeat1__numRows=Repeat1__numRows-1
      rsNews.MoveNext()
    Wend
    %>
        <tr>
          <td width="1" height="1"></td>
          <td width="398" height="1"></td>
        </tr>
      </table>
    <%
    end if
    %>
    <table width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td></td>
      </tr>
      <tr>
        <td></td></td></tr>
      <tr>
        <td></tr></td></tr>
    </table>
      </div>
    P.S.
    Questo 3d č presente nella parte xtml ed il titolo della discussione era un altro.
    Per "correttezza" ho pensato che fosse meglio postarlo anche in questa sessione del forum

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Il crossposting č vietato.
    Ad ogni modo, il problema qual'č?

    Roby

  3. #3
    Utente di HTML.it L'avatar di Girogio
    Registrato dal
    May 2007
    Messaggi
    366
    Ciao Roby...scusami tu e tutto il forum nn volevo....
    Il problema č che vorrei fare una cosa del genere

    codice:
    rsnews.open ....
    if not rsnews.eof then
    
     response.write("<ul id=""news"">")
     do while not rsnews.eof
       response.write("[*]""><%=titolonews%>")
       rsnews.movenext
     loop
     response.write("[/list]")
    end if

    per sostituire le tabelle che contengono le news ma con lo script,sopra, (preso da internet e modificato) nn sō dove metterci le mani....diciamo che nn ci capisco granchč....
    Spero mi possiate dare un indicazione per farmi anche capire come devo agire..il resto me lo faccio da me


  4. #4
    <ul id="news">
    [*]
    <span class="Stile1">Sommario
    delle news di oggi <%=Date()%></span>

    <%
    While ((Repeat1__numRows <> 0) AND (NOT rsNews.EOF))
    %>[*]
    <font size="1" face="Verdana, Arial, Helvetica, sans-serif">"><%=(rsNews.Fields.Item("titolo").Value)%></font>


    <%
    Repeat1__index=Repeat1__index+1
    Repeat1__numRows=Repeat1__numRows-1
    rsNews.MoveNext()
    Wend
    %>

    <%
    end if
    %>
    </div>

    credo sostituendo quanto sopra al codice interposto tra i tag <table> dovresti in qualche modo avere un'idea di come procedere

  5. #5
    Utente di HTML.it L'avatar di Girogio
    Registrato dal
    May 2007
    Messaggi
    366
    Grazie mille...
    vedo che sei di Cosangeles (Arcavacata )...io ho fatto 7 anni di un'Universitā lė
    che bel periodo....grande Calabria...!!
    Ciao ed ancora grazie ora provo..ti faccio sačere..

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.