tailieunhanh - PHP and MySQL Web Development - P146

PHP and MySQL Web Development - P146: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | Adding New Articles 697 Figure Replies have the text of the original automatically inserted and marked. Listing Allows a User to Type a New Post or Reply to an Existing Post php include title HTTP_POST_VARS title poster HTTP_POST_VARS poster message HTTP_POST_VARS message if isset HTTP_GET_VARS parent parent HTTP_GET_VARS parent else parent HTTP_POST_VARS parent if area area 1 if error if parent 698 Chapter 29 Building Web Forums Listing Continued 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 do_html_header title display_new_post_form parent area title message poster 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 Adding New Articles 699 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_quot-ing . These functions are all from the library. They are shown in Listings and respectively. Listing get_post_title Function from Retrieves a Message s Title from the Database function get_post_title postid extract one post s name from the database if postid return conn db_connect .

TỪ KHÓA LIÊN QUAN