TAILIEUCHUNG - Phát triển web với PHP và MySQL - p 77

Building Web Forums CHAPTER 29 735 First, look at the URL: http://webserver/chapter29/ The parameter passed in as parent will be the parent postid of the new posting. If you click New Post instead of Reply, you will get parent=0 in the URL. Second, you will see that for a reply, the text of the original message is inserted and marked with a “” character as is the case in most mail and news reading programs. Third, you can see that the title of this message defaults to the title of the original message prefixed with “Re:”. Let’s look at the code that produces this. | Building Web Forums 735 Chapter 29 First look at the URL http webserver chapter29 parent 5 The parameter passed in as parent will be the parent postid of the new posting. If you click New Post instead of Reply you will get parent 0 in the URL. Second you will see that for a reply the text of the original message is inserted and marked with a character as is the case in most mail and news reading programs. Third you can see that the title of this message defaults to the title of the original message prefixed with Re . Let s look at the code that produces this output. It is shown in Listing . Listing new Allows a User to Type a New Post or Reply to an Existing Post include if area area 1 if error if parent parent 0 if title title New Post else get post name title get_post_title parent append Re if strstr title Re false title Re . title make sure title will still fit in db title substr title 0 20 prepend a quoting pattern to the post you are replying to message add_quoting get_post_message parent 29 Building Web Forums Building Practical PHP and MySQL Projects 736 Part V Listing Continued do_html_header title display_new_post_form parent area title message name if error echo Your message was not stored. Make sure you have filled in all fields and try again. do_html_footer After some initial setting up this script checks whether the parent is zero or otherwise. If it is zero this is a new topic and little further work is needed. If this is a reply parent is the postid of an existing article then the script goes ahead and sets up the title and the text of the original message as follows get post name title get_post_title parent append Re if strstr title Re false title Re . title make sure title will still fit in db title substr title 0 20 prepend a quoting pattern to the post you are replying to message add_quoting get_post_message parent The functions it uses here are get_post_title get_post_message and add_quoting .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.