31 marzo 2003 alle 16:09:43 ciao a tutti ... Questo codice serve a visualizzare tutti gli articoli presenti in una categoria ...
Sub DisplayArticlesSearch(iCategory) Dim oCn, oRs, rSQL, bFirst, iNbPages
bFirst = True
Set oCn = DBConnexion(DB_MAIN)
If iCategory = "" Then iCategory = 0 rSQL = "SELECT arId, arTitle, arAuthor, arDescription, arDate, count(apID) as NbPages FROM articles, articlespages, versions WHERE arID=apArticle AND arVersion=vID AND arValid=1 AND apValid=1 AND arCategory=" & iCategory If sXMLVersion <> "" Then rSQL = rSQL & " AND vCode='" & sXMLVersion & "'" rSQL = rSQL & " GROUP BY arID, arDate, arTitle, arAuthor, arDescription, arDate ORDER BY arDate"
Set oRs = DBRecordSet(oCn, rSQL)
If Not oRs.EOF Then CreateTopTable "ArticlesByCategory", GetTranslation("LANG_ARTICLES")
While Not oRs.EOF If Not bFirst Then Response.Write "<br><br>" & vbCRLF iNbPages = oRs("NbPages")
oCn.Close Set oCn = Nothing Set oRs = Nothing End Sub
come posso modificarlo per far si che mi visualizzi solo gli ultimi 5 articoli inseriti nella categoria ? grazie
Arago
--------------- www.arago.it
Arago
Amatore
33 Discussioni
02 aprile 2003 alle 13:12:32 Ciao a tutti ... anche stavolta .. haimè ... ho scoperto l'acqua calda :-) ho modificato il codice in questo nel seguente modo quindi aggiungendo questa "nuova" sub routine :
Sub DisplayArticlesSearchhome(iCategory, iTop) Dim oCn, oRs, rSQL, bFirst, iNbPages
bFirst = True
Set oCn = DBConnexion(DB_MAIN)
If iCategory = "" Then iCategory = 0
If iTop = "" Then iTop = 1
rSQL = "SELECT TOP " & iTop & " arId, arTitle, arAuthor, arDescription, arDate, count(apID) as NbPages FROM articles, articlespages, versions WHERE arID=apArticle AND arVersion=vID AND arValid=1 AND apValid=1 AND arCategory=" & iCategory If sXMLVersion <> "" Then rSQL = rSQL & " AND vCode='" & sXMLVersion & "'" rSQL = rSQL & " GROUP BY arID, arDate, arTitle, arAuthor, arDescription, arDate ORDER BY arDate DESC"
Set oRs = DBRecordSet(oCn, rSQL)
If Not oRs.EOF Then CreateTopTable "ArticlesByCategory", GetTranslation("LANG_ARTICLES")
While Not oRs.EOF
If Not bFirst Then Response.Write "<br><br>" & vbCRLF iNbPages = oRs("NbPages")