Bài 13: Bạn có gửi bài/không gửi bài theo từng Chủ đề Tác giả: Phan Hồng Phúc phucorcl@yahoo.com 1.. Tạo file participated_inc.asp trong thư mục inlcudes có nội dung 1.. Mở file active
Trang 1Bài 13: Bạn có gửi bài/không gửi bài theo từng Chủ đề
Tác giả: Phan Hồng Phúc (phucorcl@yahoo.com)
1 Tạo file participated_inc.asp trong thư mục inlcudes có nội dung
<%
if(lngLoggedInUserID <> 2) then 'checks to see if it's a guest i'm not sure exactly how to check if no user is logged in :(
set rsParticipated = server.createobject("ADODB.recordset")
rsParticipated.CursorType = 1
tblThread.Topic_Id = " & lngTopicID & " AND tblThread.Author_ID = " &
lngLoggedInUserID, adoCon
if(NOT rsParticipated.EOF)then 'a thread was found authored by them and they are not a guest
Response.Write("<img src=""" &
"./forum_images/mod/topic_read.gif"" border=""0"" alt=""" & strTxtYouHavePost &
""">")'Whatever u need to indicate to the user that he/she has participated in the forum
else Response.Write("<img src=""" &
"./forum_images/mod/topic_not_read.gif"" border=""0"" alt=""" & strTxtYouHaveNot &
""">")'Whatever u need to indicate to the user that he/she has participated in the forum
rsParticipated.close
set rsParticipated = Nothing
%>
1 Mở file active_topics.asp
Trang 2a.1 Tìm dòng code
If blnAdmin OR blnModerator Then Response.Write("<a
href=""javascript:winOpener('pop_up_topic_admin.asp?TID=" & lngTopicID &
strQsSID2 & "','admin',1,1,480,265)""><img src=""" & strImagePath &
"small_admin_icon.gif"" align=""absmiddle"" border=""0"" alt=""" & strTxtTopicAdmin
& """></a>")
a.2 Thêm xuống dưới
Response.Write(vbCrLf)
%><! #include file="includes/participated_inc.asp" ><%
Response.Write(vbCrLf)
2 Mở file forum_topics.asp
a.1 Tìm dòng code
If blnAdmin OR blnModerator Then Response.Write("<a
href=""javascript:winOpener('pop_up_topic_admin.asp?TID=" & lngTopicID &
strQsSID2 & "','admin',1,1,480,265)""><img src=""" & strImagePath &
"small_admin_icon.gif"" align=""absmiddle"" border=""0"" alt=""" & strTxtTopicAdmin
& """></a>")
a.2 Thêm xuống dưới
Response.Write(vbCrLf)
%><! #include file="includes/participated_inc.asp" ><%
Response.Write(vbCrLf)
3 Mở file _language_file_inc.asp
a.1 Tìm dòng code
Const strTxtAddMedia = "Nhạc Media"
a.2 Thêm xuống dưới
Const strTxtYouHavePost = "Bạn có gửi bài"
Const strTxtYouHaveNot = "Bạn không có gửi bài"
4 Copy file post vào thư mục forum_images/mod
Bài 14: Sắp xếp bài viết trong từng Box cho việc hiển thị
Tác giả: Phan Hồng Phúc (phucorcl@yahoo.com)
Trang 31 Hình vẽ
2 Tạo file form_sort_inc.asp trong thư mục inlcudes có nội dung
<br />
<fieldset STYLE="PADDING: 2px;BORDER: solid 1px;WIDTH: 250px;">
<legend STYLE="FONT-WEIGHT: bold;"><%=strTxtSortBy%></legend>
<div>
<table>
<form name=frmsort action="" method=Get>
<input type=hidden name=FID value="<%=intForumID%>" />
<tr>
<td>
<select name=SO onchange="frmsort.submit()">
<%
Dim arrSortBy(5), arrLabelSortBy(5), nSortBy
Trang 4arrLabelSortBy(1) = strtxtTopics
For nSortBy = 1 to Ubound(arrSortBy)
if Request.QueryString("SO") = arrSortBy(nSortBy) then
arrSortBy(nSortBy) & ">" & arrLabelSortBy(nSortBy) & "</option>"
else
">" & arrLabelSortBy(nSortBy) & "</option>"
end if Next
%>
</select>
</td>
<td><%=strTxtOrderBy%></td>
<td>
<select name=OB onchange="frmsort.submit()">
<option value="desc"><%=strTxtDESC%></option>
<option <%if Request.QueryString("OB") = "asc" then Response.Write
"Selected"%> value="asc"><%=strTxtASC%></option>
</select>
</td>
<td><input class=button type=submit value="<%=strTxtResult%>" /></td>
</tr>
</form>
Trang 5</table>
</div>
</fieldset>
<br />
3 Mở file forum_topics.asp
a.1 Tìm dòng code
%></td>
<td align="right" nowrap><! #include file="includes/page_link_inc.asp" ></td> a.2 Thay thế bằng
%>
<! #include file="includes/form_sort_inc.asp" >
</td>
<td align="right" nowrap><! #include file="includes/page_link_inc.asp" ></td>
4 Mở file ha_language_file_inc.asp
a.1 Tìm dòng code
Const strTxtYouHaveNot = "Bạn không có gửi bài"
a.2 Thêm xuống dưới
Const strTxtSortBy = "Sắp xếp theo"
Const strTxtOrderBy = "chiều"
Const strTxtASC = "Tăng dần"
Const strTxtDESC = "Giảm dần"
Const strTxtResult = "Kết quả"