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 6 pot

7 278 0
Tài liệu đã được kiểm tra trùng lặp

Đ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 7
Dung lượng 239,45 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

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.. Tìm dòng code If lngNumberOfPosts 0 Then 'Don'

Trang 1

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

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 />")

Bài 13: Bạn có gửi bài/không gửi bài theo từng Chủ đề

Trang 2

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

%>

2 Mở file active_topics.asp

a.1 Tìm dòng code

Trang 3

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 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)

4 Mở file _language_file_inc.asp

a.1 Tìm dòng code

Const strTxtAddMedia = "Nh&#7841;c Media"

a.2 Thêm xuống dưới

Const strTxtYouHavePost = "B&#7841;n c&#243; g&#7917;i b&#224;i"

Const strTxtYouHaveNot = "B&#7841;n kh&#244;ng c&#243; g&#7917;i b&#224;i"

5 Copy file post vào thư mục forum_images/mod

Trang 4

Bài 14: Sắp xếp bài viết trong từng Box cho việc hiển thị

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>

Trang 5

<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()">

Trang 6

<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&#7841;n kh&#244;ng c&#243; g&#7917;i b&#224;i"

a.2 Thêm xuống dưới

Const strTxtSortBy = "S&#7855;p x&#7871;p theo"

Const strTxtOrderBy = "chi&#7873;u"

Trang 7

Const strTxtASC = "T&#259;ng d&#7847;n" Const strTxtDESC = "Gi&#7843;m d&#7847;n" Const strTxtResult = "K&#7871;t qu&#7843;"

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

TỪ KHÓA LIÊN QUAN

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

TÀI LIỆU LIÊN QUAN

🧩 Sản phẩm bạn có thể quan tâm