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 ()
1. Tạo file participated_inc.asp trong thư mục inlcudes có nội dung
<%
Dim rsParticipated
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
rsParticipated.Open "select top 1 tblThread.Thread_ID from tblThread where
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
end if
rsParticipated.close
set rsParticipated = Nothing
end if
%>
1. Mở file active_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)
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 ()
1. 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
arrSortBy(1) = "T"
arrLabelSortBy(1) = strtxtTopics
arrSortBy(2) = "A"
arrLabelSortBy(2) = strtxtAuthor
arrSortBy(3) = "R"
arrLabelSortBy(3) = strtxtReplies
arrSortBy(4) = "V"
arrLabelSortBy(4) = strtxtViews
arrSortBy(5) = ""
arrLabelSortBy(5) = strTxtLastPost
For nSortBy = 1 to Ubound(arrSortBy)
if Request.QueryString("SO") = arrSortBy(nSortBy) then
Response.Write "<option selected value=" &
arrSortBy(nSortBy) & ">" & arrLabelSortBy(nSortBy) & "</option>"
else
Response.Write "<option value=" & arrSortBy(nSortBy) &
">" & 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>
</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ả"