1. Trang chủ
  2. » Công Nghệ Thông Tin

Hướng dẫn thiết kế : Thiết kế Forum nhanh chóng và đơn giản phần 7 pps

5 368 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 81,76 KB

Nội dung

Bài 15: Tỷ lệ hoạt động của từng Box 1. Mở file ha_language_file_inc.asp a.1. Tìm dòng code Const strTxtResult = "K&#7871;t qu&#7843;" a.2. Thêm xuống dưới Const strTxtActivity = "Ho&#7841;t &#273;&#7897;ng" 2. Mở file default.asp a.1. Tìm dòng code Dim strSubject a.2. Thêm xuống dưới Dim rsNoofPostAll Dim lngTotalNumberOfPostsAll Dim lngNumberOfPostsAll Dim lngTmp Dim intNumOfForums b.1. Tìm dòng code lngLastEntryUserID = lngLastSubEntryUserID dtmLastEntryDateAllForums = dtmLastSubEntryDate End If b.2. Thêm xuống dưới lngTmp = 0 intNumOfForums = 0 lngTmp = lngSubForumNumberOfPosts intNumOfForums = intNumOfForums + lngTmp strSQL = "SELECT " & strDbTable & "Forum.* FROM " & strDbTable & "Forum ORDER BY " & strDbTable & "Forum.Forum_Order ASC;" Set rsNoofPostAll = Server.CreateObject("ADODB.Recordset") rsNoofPostAll.Open strSQL, adoCon lngTotalNumberOfPostsAll = 0 lngNumberOfPostsAll = 0 Do While NOT rsNoofPostAll.EOF lngNumberOfPostsAll = CLng(rsNoofPostAll("No_of_posts")) lngTotalNumberOfPostsAll = lngTotalNumberOfPostsAll + lngNumberOfPostsAll rsNoofPostAll.MoveNext Loop rsNoofPostAll.Close Set rsNoofPostAll = Nothing c.1 Tìm dòng code strSubForums = strSubForums & "<br /><img src=""" & strImagePath & "mod/folder_line.gif"" border=""0"" align=""absmiddle"">&nbsp;<a href=""forum_topics.asp?FID=" & intSubForumID & strQsSID2 & """ class=""smLink"">" & strSubForumName & "</a>" c.2. Thay thế bằng strSubForums = strSubForums & "<br /><img src=""" & strImagePath & "mod/folder_line.gif"" border=""0"" align=""absmiddle"">&nbsp;<a href=""forum_topics.asp?FID=" & intSubForumID & strQsSID2 & """ class=""smLink"">" & strSubForumName & "</a>" & " (" & Round((intNumOfForums/lngTotalNumberOfPostsAll)*100,2) & "%)" d.1 Tìm dòng code Response.Write("<br />" & strForumDiscription & strSubForums & "</td>" & _ vbCrLf & " <td class=""smText"" align=""right"" nowrap>") d.2. Thay thế bằng Response.Write("<br />" & strForumDiscription & strSubForums) strSQL = "SELECT " & strDbTable & "Forum.* FROM " & strDbTable & "Forum ORDER BY " & strDbTable & "Forum.Forum_Order ASC;" Set rsNoofPostAll = Server.CreateObject("ADODB.Recordset") rsNoofPostAll.Open strSQL, adoCon lngTotalNumberOfPostsAll = 0 lngNumberOfPostsAll = 0 Do While NOT rsNoofPostAll.EOF lngNumberOfPostsAll = CLng(rsNoofPostAll("No_of_posts")) lngTotalNumberOfPostsAll = lngTotalNumberOfPostsAll + lngNumberOfPostsAll rsNoofPostAll.MoveNext Loop rsNoofPostAll.Close Set rsNoofPostAll = Nothing strSQL = "SELECT " & strDbTable & "Forum.* FROM " & strDbTable & "Forum WHERE " & strDbTable & "Forum.Sub_ID = " & intForumID & " ORDER BY " & strDbTable & "Forum.Forum_Order ASC;" Dim rsNoofPostSubForum Set rsNoofPostSubForum = Server.CreateObject("ADODB.Recordset") rsNoofPostSubForum.CursorType = 1 'Query the database rsNoofPostSubForum.Open strSQL, adoCon lngTmp = 0 intNumOfForums = 0 Do While NOT rsNoofPostSubForum.EOF lngTmp = CLng(rsNoofPostSubForum("No_of_posts")) intNumOfForums = intNumOfForums + lngTmp rsNoofPostSubForum.MoveNext Loop Response.Write(vbCrLf & "<br /><span class=""tiText"">") Response.Write( strTxtActivity & ": " & "</span>") If lngNumberOfPosts <> 0 Then If intNumOfForums <> 0 Then Dim dblPollVotePercentageSub dblPollVotePercentageSub = FormatPercent(((lngNumberOfPosts+intNumOfForums)/lngTotalN umberOfPostsAll), 2) %> <img src="<% = strImagePath %>bar_graph_image.gif" width="<% = CInt(Replace(CStr(dblPollVotePercentageSub), "%", "", 1, -1, 1)) * 2 %>" height="11" align="middle"> [<% = dblPollVotePercentageSub %>] <% Else Dim dblPollVotePercentage dblPollVotePercentage = FormatPercent((lngNumberOfPosts/lngTotalNumberOfPostsAll), 2) %> <img src="<% = strImagePath %>bar_graph_image.gif" width="<% = CInt(Replace(CStr(dblPollVotePercentage), "%", "", 1, -1, 1)) * 2 %>" height="11" align="middle"> [<% = dblPollVotePercentage %>] <% End If Else If intNumOfForums <> 0 Then dblPollVotePercentageSub = FormatPercent(((lngNumberOfPosts+intNumOfForums)/lngTotalN umberOfPostsAll), 2) %> <img src="<% = strImagePath %>bar_graph_image.gif" width="<% = CInt(Replace(CStr(dblPollVotePercentageSub), "%", "", 1, -1, 1)) * 2 %>" height="11" align="middle"> [<% = dblPollVotePercentageSub %>] <% Else %> <img src="<% = strImagePath %>bar_graph_image.gif" width="<% = CInt(Replace(CStr(0), "%", "", 1, -1, 1)) * 2 %>" height="11" align="middle"> [0%] <% End If End If rsNoofPostSubForum.Close() Set rsNoofPostSubForum = Nothing Response.Write("</td>" & vbCrLf & " <td class=""smText"" align=""right"" nowrap>") . rsNoofPostSubForum.Open strSQL, adoCon lngTmp = 0 intNumOfForums = 0 Do While NOT rsNoofPostSubForum.EOF lngTmp = CLng(rsNoofPostSubForum("No_of_posts")) intNumOfForums = intNumOfForums. strDbTable & " ;Forum. Forum_Order ASC;" Dim rsNoofPostSubForum Set rsNoofPostSubForum = Server.CreateObject("ADODB.Recordset") rsNoofPostSubForum.CursorType = 1 . lngTmp = lngSubForumNumberOfPosts intNumOfForums = intNumOfForums + lngTmp strSQL = "SELECT " & strDbTable & " ;Forum. * FROM " & strDbTable & " ;Forum ORDER

Ngày đăng: 30/07/2014, 12:21

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN