Visualizzazione dei risultati da 1 a 7 su 7

Discussione: aiuto random codice

  1. #1
    Utente di HTML.it
    Registrato dal
    Nov 2004
    Messaggi
    111

    aiuto random codice

    Salve a tutti cerco aiuto per modificare il mio codice da fisso a random :

    Questo e il codice fisso

    strSQL = "SELECT " & tablPfx & "Ads.adID," & tablPfx & "Ads.nick," & tablPfx & "Ads.userID," & tablPfx & "Ads.pdate," & tablPfx & "Ads.pdate," & tablPfx
    strSQL = strSQL & "Ads.subject," & tablPfx & "Ads.body," & tablPfx & "Ads.images FROM " & tablPfx
    strSQL = strSQL & "Ads WHERE (hotlist = 1 AND status = 1) ORDER BY " & tablPfx & "Ads.pdate DESC, " & tablPfx & "Ads.images DESC;"



    e vorrei trasformalo in random. Qui di seguito il codice modificato in random pero a il codice cancellato dal cancellatto . Mi potet aiuatre a far funzionare questo codice. Grazie

    HotNum = #########
    Rand ########## (##)
    int############# = Int (############)+1

    strSQL = "SELECT #############, (########), ############# ,############# , ############# ############# tablPfx & "Ads.adID," & tablPfx & "Ads.nick," & tablPfx & "Ads.userID," & tablPfx & "Ads.pdate," & tablPfx & "Ads.pdate," & tablPfx
    strSQL = strSQL & "Ads.subject," & tablPfx & "Ads.body," & tablPfx & "Ads.images "
    StrSQL = strSQL & " #############, (###), ########################## FROM " & tablPfx
    StrSQL = strSQL & "Ads WHERE (hotlist = 1 AND status = 1) ORDER BY #############, ############## (############## ) , #############,############# , ############# (###)



    Grazie a Tutti

  2. #2
    ma perchè è cancellato con i cancelletti?


    cmq che vuol dire codice random? non è che abbia molto senso

  3. #3
    Utente di HTML.it
    Registrato dal
    Nov 2004
    Messaggi
    111
    il random e nel caso di molte immagini vengo esposte in una tabella di 10 foto e ruotano con l' aggiornamento della pagina . Il codice e cancellato perche vendono in un sito americano il codice modificato .


    Saluti

  4. #4
    Mica ho capito io... :master:

  5. #5
    Utente di HTML.it
    Registrato dal
    Nov 2004
    Messaggi
    111
    ho un portale di annunci gratuiti e c'e un opzione dove posso mettere gli annunci sponsorizzati pero mi appaiono gli annunci piu nuovi in prima linea e i vecchi non si vedono piu in una lista di 10 annunci . Vorrei con quel codice far uscire gli annunci in modo causale e non per il piu nuovo .

    sono stato chiaro ?

    saluti

  6. #6
    Originariamente inviato da infonet
    sono stato chiaro ?
    Decisamente meglio di prima...
    Guarda qui, trovi ilcodice che randomizza http://forum.html.it/forum/showthrea...07#post9871607

  7. #7
    Utente di HTML.it
    Registrato dal
    Nov 2004
    Messaggi
    111
    il codice che ho inviato fa parte di uno script che e installato nel mio servizio che ti allego :


    </p>
    <p align="center"> </p><div align="center">
    <table border="0" width="100%" >
    <tr>
    <td height="20"><%= strText_Home %>::<%= strText_WhatsHot %></td>
    </tr>
    <tr>
    <td class="line">
    </td>
    </tr>
    </table></div>


    <div align="center"><table border="0" cellspacing="0" cellpadding="0" width="100%" height="1">
    <tr>
    <td align="center" height="18">[img]img/hot.gif[/img]<font face="Georgia" size="4" color="#808080" /><%= strText_FeaturedClassifiedAds %></font>
    [img]img/hot.gif[/img]
    </td>
    </tr>
    </table></div>


    <%
    Dim totalPage, totalRecords, displayRecords


    '**** Number of columns

    cols = 2

    strSQL = "SELECT " & tablPfx & "Ads.adID," & tablPfx & "Ads.nick," & tablPfx & "Ads.userID," & tablPfx & "Ads.pdate," & tablPfx & "Ads.pdate," & tablPfx
    strSQL = strSQL & "Ads.subject," & tablPfx & "Ads.body," & tablPfx & "Ads.images FROM " & tablPfx
    strSQL = strSQL & "Ads WHERE (hotlist = 1 AND status = 1) ORDER BY " & tablPfx & "Ads.pdate DESC, " & tablPfx & "Ads.images DESC;"

    rs.PageSize = pp
    rs.CacheSize = pp
    rs.CursorLocation = 3
    rs.Open strSQL, strConn, 0, 1

    If rs.EOF then
    Response.Write "<p align='center'>" & strText_HotListEmpty & "</p>"
    Else
    %>

    <div align="center"><table width="100%" border="0" cellpadding="6">
    <%
    Set re = new RegExp
    re.global=true
    re.ignoreCase=true
    re.multiLine=true
    re.Pattern = "(<[^>]*>)|(" & vbCrLf & ")|(\s{2,})"
    hc = 1

    nPage = Session("hotlist_show_page" & strSUnique)
    URLlink = "hotlist.asp?" & Server.URLEncode(Request.Querystring)
    pageType = 21
    strPaging = buildPages(nPage, URLlink, pageType) '## paging built in libraries.asp
    Response.Write "
    " & strPaging
    Response.Write "<div align='left' style=""font-size:7pt; margin-left: 10;"">" & strText_TotalPages & ": " & totalPage & "
    "
    Response.Write strText_TotalPosted & ": " & totalRecords & "</div>"

    For J = 1 to displayRecords
    If Not rs.EOF then
    If hc mod cols = 1 then Response.Write "<tr>" & vbcrlf
    Response.Write "<td align='center' width='50%' valign='top' height='100'>" & vbcrlf
    adID = rs(0)
    userID = rs(2)
    postedOn = FormatDateTime(CDate(rs(3)), 2)
    subject = rs(5)
    subject = "<font color=''>" & subject & "</font>"
    nick = rs(1)
    ds = Empty
    nick = "" & nick & ""
    adDescr = rs(6)
    adDescr = Replace(adDescr, "
    ", " ")
    On Error Resume Next
    If re.test(adDescr) then adDescr = re.replace(adDescr, "")
    On Error GoTo 0
    If Len(adDescr) > 100 then adDescr = Left(adDescr, 100)
    adImgArray = rs(7)
    If not adImgArray = Empty then
    firstImg = Split(adImgArray, sf)(0)
    firstImgName = Split(firstImg, "|")(0)
    imgDim = Split(firstImg, "|")(1)
    w = Split(imgDim, "x")(0)
    h = Split(imgDim, "x")(1)
    If h > 80 then
    koef = h / w
    h = 80
    w = Round(100 / koef)
    Else
    If w > 80 then
    koef = w / h
    w = 80
    h = Round(80 / koef)
    End If
    End If
    imgData = "[img]" & upload & firstImgName & "[/img]"
    Else: imgData = "[img]img/nopics.gif[/img]"
    End If
    %>
    <div align="left">
    <table border="0" width="100%" cellspacing="3" class="hotlist" cellpadding="0" height="100%">
    <tr>
    <td style="font-size: 10pt" colspan="2" valign="top" class="hotimgcell" height="15">
    <%= subject %>
    </td>
    <td align="center" height="100%" class="hotimgcell" rowspan="3" width="100">
    <%= imgData %>
    </td>
    </tr>
    <tr>
    <td colspan="2" height="100%" class="hot_cell">
    <div align="justify" style="margin-right: 5; margin-left: 5;"><%= adDescr %> ... <%= strText_more %></div>
    </td>
    </tr>
    <tr>
    <td valign="bottom" class="hotimgcell" height="15">
    <%= strText_Postedby %>: <%= nick %>
    </td>
    <td align="right" valign="bottom" class="hotimgcell" height="15">
    <%= strText_PostedOn %>: <%= postedOn %>
    </td>
    </tr>
    </table>
    </div>
    <%
    Response.Write "</td>"
    If hc mod cols = 0 then Response.Write "</tr>" & vbcrlf
    hc = hc + 1
    rs.MoveNext
    End If
    Next
    %>
    </table></div>
    <%
    End If
    rs.close
    %>

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 © 2025 vBulletin Solutions, Inc. All rights reserved.