Tải bản đầy đủ (.pdf) (5 trang)

Code lập trình - Bài 9, 10, 11 & 12 doc

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (169.54 KB, 5 trang )

Bài 9: Số bài viết trung bình mỗi ngày

Tác giả: Phan Hồng Phúc ()

1. Mở file forum_posts.asp
a.1. Tìm dòng code
Response.Write(vbCrLf & " <br />" & strTxtPosts & ": " & lngAuthorNumOfPosts)
a.2. Thay thế bằng
Response.Write("<br />" & strTxtPosts & ": ")
%>
<% = lngAuthorNumOfPosts %> <% If lngAuthorNumOfPosts > 0 AND DateDiff("d",
dtmAuthorRegistration, Now()) > 0 Then Response.Write(" [" &
FormatNumber(lngAuthorNumOfPosts / DateDiff("d", dtmAuthorRegistration, Now()),
2) & " " & strTxtPostsPerDay) & "]" %>
<%


Bài 10: Kinh nghiệm

Tác giả: Phan Hồng Phúc ()

1. Mở file forum_posts.asp
a.1. Tìm dòng code
Dim strSex 'Hold the sex of member
a.2. Thêm xuống dưới
Dim lngExp, lngAuthorNumOfPostsExp, rsPostExp
lngAuthorNumOfPostsExp = 0
Set rsPostExp = Server.CreateObject("ADODB.Recordset")

strSQL = "SELECT " & strDbTable & "Author.No_of_posts "
strSQL = strSQL & "FROM " & strDbTable & "Author; "



'Set the cursor type property of the record set to dynamic so we can naviagate through the
record set
rsPostExp.CursorType = 1

'Query the database
rsPostExp.Open strSQL, adoCon
Do While NOT rsPostExp.EOF
lngAuthorNumOfPostsExp = lngAuthorNumOfPostsExp +
CLng(rsPostExp("No_of_posts"))
rsPostExp.MoveNext
Loop
rsPostExp.Close()
Set rsPostExp = Nothing
b.1. Tìm dòng code
Response.Write("<br />" & strTxtPosts & ": ")
%>
<% = lngAuthorNumOfPosts %> <% If lngAuthorNumOfPosts > 0 AND DateDiff("d",
dtmAuthorRegistration, Now()) > 0 Then Response.Write(" [" &
FormatNumber(lngAuthorNumOfPosts / DateDiff("d", dtmAuthorRegistration, Now()),
2) & " " & strTxtPostsPerDay) & "]" %>
<%
b.2. Thêm xuống dưới
Response.Write("<br />" & strTxtExp & ": ")
lngExp = FormatPercent(lngAuthorNumOfPosts/lngAuthorNumOfPostsExp,2)
%>
<img src="<% = strImagePath %>bar_graph_image.gif" width="<% =
CInt(Replace(CStr(lngExp), "%", "", 1, -1, 1)) * 2 %>" height="11" align="middle">
[<% = lngExp %>]
<%



Bài 11: Nút Music – Flash

Tác giả:
Phan Hồng Phúc ()

1. Tạo file RTE_function.asp trong thư mục RTE_configuration có nội dung
//Add by flash, music,real, math by
function paste_embed(type){
var url = prompt("Enter url:", "http://");
if (url !="" && url !="http://" && url != null){
var emwidth = prompt("Width:", "300");
var emheight = prompt("height:", "300");
if (type == "flash") {
url = "[FLASH WIDTH=" + emwidth + " HEIGHT=" + emheight
+ "]" + url + "[/FLASH]";
}
if (type == "media") {
url = "[MUSIC WIDTH=" + emwidth + " HEIGHT=" + emheight
+ "]" + url + "[/MUSIC]";
}

FormatText("paste", url);

}
}
2. Mở file RTE_javascript.asp
a.1. Tìm dòng code
<! #include file="RTE_configuration/RTE_setup.asp" >

a.2. Thêm xuống dưới
<! #include file="RTE_configuration/RTE_function.asp" >
3. Mở file RTE_quick_reply_toolbar_inc.asp
a.1. Tìm dòng code
Response.Write("');")
End If
a.2. Thêm xuống dưới
Response.Write(vbCrLf & " document.writeln('<img src=""" & strImagePath &
"toolbar_separator.gif"" align=""absmiddle"">")
Response.Write("<img src=""" & strImagePath & " mod/post_button_flash.gif""
align=""absmiddle"" border=""0"" onClick=""paste_embed(\'flash\')"" title=""" &
strTxtAddFlash & """ class=""WebWizRTEbutton"" onmouseover=""overIcon(this)""
onmouseout=""outIcon(this)"">")
Response.Write("<img src=""" & strImagePath & " mod/post_button_media.gif""
align=""absmiddle"" border=""0"" onClick=""paste_embed(\'media\')"" title=""" &
strTxtAddMedia & """ class=""WebWizRTEbutton"" onmouseover=""overIcon(this)""
onmouseout=""outIcon(this)"">")
Response.Write("');")
4. Mở file RTE_toolbar_inc.asp
a.1. Tìm dòng code
If blnOrderList OR blnUnOrderList OR blnOutdent OR blnIndent Or blnHorizontalRule
Then Response.Write("');")
a.2. Thêm xuống dưới
Response.Write(vbCrLf & " document.writeln('<img src=""" & strImagePath &
"toolbar_separator.gif"" align=""absmiddle"">")
Response.Write("<img src=""" & strImagePath & " mod/post_button_flash.gif""
align=""absmiddle"" border=""0"" onClick=""paste_embed(\'flash\')"" title=""" &
strTxtAddFlash & """ class=""WebWizRTEbutton"" onmouseover=""overIcon(this)""
onmouseout=""outIcon(this)"">")
Response.Write("<img src=""" & strImagePath & "mod/post_button_media.gif""

align=""absmiddle"" border=""0"" onClick=""paste_embed(\'media\')"" title=""" &
strTxtAddMedia & """ class=""WebWizRTEbutton"" onmouseover=""overIcon(this)""
onmouseout=""outIcon(this)"">")
Response.Write("');")
5. Mở file ha_language_file_inc.asp
a.1. Tìm dòng code
Const strTxtExp = "Kinh nghi&#7879;m"
a.2. Thêm xuống dưới
Const strTxtAddFlash = "Ho&#7841;t h&#236;nh Flash"
Const strTxtAddMedia = "Nh&#7841;c Media"
6. Copy file music vào thư mục forum_images/mod


Bài 12: Bài viết cuối theo từng Diễn đàn

Tác giả:
Phan Hồng Phúc ()

1. Mở file default.asp
a.1. Tìm dòng code
Dim intTotalViewingForum 'Holds the number of people viewing the forum, including
sub forums
a.2. Thêm xuống dưới
Dim strSubject
b.1. Tìm dòng code
If lngNumberOfPosts <> 0 Then 'Don't disply last post details if there are none
b.2. Thêm xuống dưới
strSQL = "SELECT TOP 1 " & strDbTable & "Topic.Subject, " & strDbTable &
"Topic.Topic_ID, "& strDbTable & "Topic.Last_Thread_ID, "& strDbTable &
"Topic.Icon FROM " & strDbTable & "Topic WHERE " & strDbTable &

"Topic.Forum_ID=" & intForumID & " ORDER BY " & strDbTable &
"Topic.Last_Thread_ID DESC;"
rsCommon.Open strSQL, adoCon
If NOT rsCommon.EOF Then
strSubject = "<a href=""forum_posts.asp?TID=" & rsCommon("Topic_ID") &
strQsSID2 & """>" & rsCommon("Subject") & "</a>"
else
strSubject = ""
End If
rsCommon.Close
Response.Write(strSubject & "<br />")



×