TAILIEUCHUNG - PHP and MySQL Web Development - P142

PHP and MySQL Web Development - P142: 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. | Solution Overview 677 We will build simple interfaces to enable saving of articles. When we load the list of articles for viewing we will load the headers of each article into a tree_node PHP class. Each tree_node will contain an article s headers and a set of the replies to that article. The replies will be stored in an array. Each reply will itself be a tree_node that can contain an array of replies to that article which are themselves tree_nodes and so on. This continues until we reach the so-called leaf nodes of the tree the nodes that do not have any replies. We will then have a tree structure that looks like the one in Figure . Some terminology The message that we are replying to can be called the parent node of the current node. Any replies to the message can be called the children of the current node. If you imagine that this tree structure is like a family tree this will be easy to remember. The first article in this tree structure the one with no parent is sometimes called the root node. I Note This can be unintuitive because we usually draw the root node at the top of diagrams unlike the roots of real trees. To build and display this tree structure we will write recursive functions. We discussed recursion in Chapter 5 Reusing Code and Writing Functions. We decided to use a class for this structure because it s the easiest way to build a complex dynamically expanding data structure for this application. It also means we have quite simple elegant code to do something quite complex. Solution Overview To really understand what we have done with this project it s probably a good idea to work through the code which we ll do in a moment. There is less bulk in this application than in some of the others but the code is a bit more complex. There are only three real pages in the application. We will have a main index page that shows all the articles in the forum as links to the articles. From here you will be able to add a new article view a listed article or

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.