29 gennaio 2004 alle 11:48:32 Ciao raga ho seguito passo passo le vostre spiegazionni per inserire il top articles in home, ma il risultato e questo :
Ora io vorrei al posto del blocco top news il top articles, senza autore e data ed inserendo i rem c'ero pure iruscito, solo che il top forum lo vedete pure voi diventa piccolissimo, e il top articles nn si ridimensiona CHE DEVO FARE?
---------------
<% ' ************************************************************************ ' * ASP-Nuke: Free web portal in ASP * ' ************************************************************************ ' * Copyright (c) 2002-2003 by Gaetan Bouveret (webmaster@asp-nuke.com) * ' * http://www.asp-nuke.com * ' * * ' * This program is free software. You can redistribute it and/or modify * ' * it under the terms of the GNU General Public License as published by * ' * the Free Software Foundation; either version 2 of the License, or * ' * (at your option) any later version. * ' * * ' ************************************************************************ %> <% ' Display the top articles list (by date) ' IN : iTop (int) : number of results wanted ' OUT : - Sub DisplayTopArticles(iTop) Dim oCn, oRs, rSQL, iLine
Set oCn = DBConnexion(DB_MAIN)
If iTop = "" Then iTop = 1 rSQL = "SELECT TOP " & iTop & " arId, arTitle, arAuthor, arDate FROM articles, articlespages, versions WHERE arVersion=vID AND arID=apArticle AND arValid=1 AND apValid=1" If sXMLVersion <> "" Then rSQL = rSQL & " AND vCode='" & sXMLVersion & "'" rSQL = rSQL & " GROUP BY arID, arTitle, arAuthor, arDate ORDER BY arDate DESC"
Set oRs = DBRecordSet(oCn, rSQL)
If Not oRs.EOF Then CreateTopTable "TopArticles", GetTranslation("LANG_TOP") & " " & iTop & " - " & GetTranslation("LANG_ARTICLES")
Response.Write "</table>" & vbCRLF CreateBottomTable "" Else CreateTable "ArticlesEmpty", "", GetTranslation("LANG_EMPTY_SECTION"), "" End If
oCn.Close Set oCn = Nothing Set oRs = Nothing End Sub
' Display a specific article ' IN : iID (int) : article's id (table articles, field arID) ' : iPage (int) : article's page number ' OUT : - Sub DisplayArticle(iID, iPage) Dim oCn, oRs, rSQL Dim sTitle, sDate, sAuthor, sCurrentContent, iCurrentHits, iNumPage Dim iCurrentPage,iPreviousPage, iNextPage, sCurrentTitle, sPreviousTitle, sNextTitle
Set oCn = DBConnexion(DB_MAIN)
iNumPage = 0 If iID = "" Then iID = 0
rSQL = "SELECT arTitle, arAuthor, arDate, apID, apTitle, apHits, apContent FROM articles, articlespages WHERE arID=apArticle AND arValid=1 AND apValid=1 AND arID=" & iID & " ORDER BY apID" Set oRs = DBRecordSet(oCn, rSQL)
If Not oRs.EOF Then sTitle = oRs("arTitle") sDate = oRs("arDate") sAuthor = oRs("arAuthor")
If iPreviousPage <> 0 OR iNextPage <> 0 Then Response.Write "<br><br>" & vbCRLF Response.Write GLOBAL_SITE_SUBTABLE & vbCRLF Response.Write " <tr class=""tablelinemain"">" & vbCRLF Response.Write " <td width=""50%"">" If iPreviousPage <> 0 Then Response.Write "<span class=""small""><a href=""" & sURLPage & "?id=" & iID & "&page=" & iPage-1 & """><< " & CodeMessage(sPreviousTitle, True) & "</a></span>" Else Response.Write " " End If Response.Write "</td>" & vbCRLF Response.Write " <td width=""50%"" align=""right"">" If iNextPage <> 0 Then Response.Write "<span class=""small""><a href=""" & sURLPage & "?id=" & iID & "&page=" & iPage+1 & """>" & CodeMessage(sNextTitle, True) & " >></a></span>" Else Response.Write " " End If Response.Write "</td>" & vbCRLF Response.Write " </tr>" & vbCRLF Response.Write "</table>" & vbCRLF End If
CreateBottomTable ""
rSQL = "UPDATE articlespages SET apHits=" & iCurrentHits+1 & " WHERE apID=" & iCurrentPage DBExecute oCn, rSQL End If
oCn.Close Set oCn = Nothing Set oRs = Nothing End Sub
' Display all articles for one category ' IN : iCategory (int) : article's category (table articles, field arCategory) ' OUT : - 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
' Display a navigation bar for articles ' IN : iCategoryParent (int) : category's parent id (table categories, field cParent) ' OUT : - Sub DisplayArticlesNavigation(iCategoryParent) Dim oCn, oRs, oRs2, rSQL, iLine, iNum
Set oCn = DBConnexion(DB_MAIN)
If iCategoryParent = "" Then iCategoryParent = 0
If iCategoryParent <> 0 Then rSQL = "SELECT cId, cParent, cTitle, cDescription, cImage FROM categories WHERE cID=" & iCategoryParent
Set oRs = DBRecordSet(oCn, rSQL)
If Not oRs.EOF Then CreateTopTable "ArticleCategory", CodeMessage(oRs("cTitle"), True) If oRs("cImage") <> "" Then Response.Write "<img src=""" & Server.HTMLEncode(oRs("cImage") & "") & """ border=""0"" align=""left"">" End If Response.Write CodeMessage(oRs("cDescription"), True) Response.Write "<br><br><a href=""" & sURLPage & "?cat=" & oRs("cParent") & """>" & GetTranslation("LANG_BACK") & "</a>" & vbCRLF CreateBottomTable "" End If End If
rSQL = "SELECT DISTINCT cId, cTitle FROM categories, articles, versions WHERE arCategory=cID AND arVersion=vID AND cType=" & CATEGORY_TYPE_ARTICLES & " AND cParent=" & iCategoryParent If sXMLVersion <> "" Then rSQL = rSQL & " AND vCode='" & sXMLVersion & "'" rSQL = rSQL & " ORDER BY cTitle"
Set oRs = DBRecordSet(oCn, rSQL)
If Not oRs.EOF Then If iCategoryParent = 0 Then CreateTopTable "SearchArticleCategories", GetTranslation("LANG_ARTICLES") & " - " & GetTranslation("LANG_CATEGORIES") Else CreateTopTable "SearchArticleCategories", GetTranslation("LANG_ARTICLES") & " - " & GetTranslation("LANG_SUB_CATEGORIES") End If Response.Write GLOBAL_SITE_SUBTABLE & vbCRLF iLine = 1 iNum = 0
While Not oRs.EOF If iNum mod 2 = 0 Then Response.Write " <tr class=""tableline" & iLine & """>" & vbCRLF rSQL = "SELECT Count(arID) FROM articles, versions, articlespages WHERE arVersion=vID AND arID=apArticle AND arValid=1 AND apValid=1 AND arCategory=" & oRs("cID") If sXMLVersion <> "" Then rSQL = rSQL & " AND vCode='" & sXMLVersion & "'" Set oRs2 = DBRecordSet(oCn, rSQL) Response.Write " <td width=""50%""><a href=""" & sURLPage & "?cat=" & oRs("cID") & """>" & Server.HTMLEncode(oRs("cTitle")) & " (" & oRs2(0) & ")</td>" & vbCRLF If iNum mod 2 = 1 Then Response.Write " </tr>" & vbCRLF iLine = 1 + ((iLine-1) XOR 1) End If
iNum = iNum + 1 oRs.MoveNext WEnd If iNum mod 2 = 1 Then Response.Write " <td> </td>" & vbCRLF Response.Write " </tr>" & vbCRLF End If
Response.Write "</table>" & vbCRLF CreateBottomTable "" End If
oCn.Close Set oCn = Nothing Set oRs = Nothing End Sub
' Display page ' IN : - ' OUT : - Sub DisplayArticlesPage() Dim iCat, iPage, iArticleID
iCat = Request.QueryString("cat") If IsNumeric(iCat) and iCat <> "" Then iCat = CInt(iCat) Else iCat = 0 End If
iPage = Request.QueryString("page") If IsNumeric(iPage) and iPage <> "" Then iPage = CInt(iPage) Else iPage = 1 End If
iArticleID = Request.QueryString("id") If IsNumeric(iArticleID) and iArticleID <> "" Then iArticleID = CInt(iArticleID) Else iArticleID = 0 End If
If iArticleID = 0 Then DisplayArticlesNavigation(iCat)
If iCat = 0 and iArticleID = 0 Then DisplayTopArticles GLOBAL_ARTICLES_TOP Else If iCat <> 0 Then DisplayArticlesSearch(iCat) If iArticleID <> 0 Then DisplayArticle(iArticleID), iPage End If End Sub %>
---------------
29 gennaio 2004 alle 12:55:38 C'erano degli errori di battitura nel testo, scarica di nuovo la procedura e ricopia il codice, e rifai la modifica al file articles-inc. Ciauzz DJ
--------------- A lavare la testa ai somari, ci si rimette l'acqua e il sapone!