tailieunhanh - PHP for Absolute Beginners PHẦN 6

Trong chương này, bạn đã học được một tấn thông tin. Một số của nó là khá cao, vì vậy xin chúc mừng chính mình! Bạn có thể bây giờ là: • Hỗ trợ các trang nhiều trong ứng dụng của bạn • Tạo URL tuỳ chỉnh bằng cách sử dụng các biểu thức thông thường và htaccess • | CHAPTER 6 ADDING SUPPORT FOR MULTIPLE PAGES Figure 6-11. The full About the Author entry display Summary In this chapter you ve learned a ton of information. Some of it was pretty advanced so congratulate yourself You can now Support multiple pages in your application Create custom URLs using regular expressions and .htaccess Differentiate between multi-entry and single-entry pages In the next chapter you ll learn how to update entries that have already been created bringing you one step closer to having a fully customizable blogging application. 186 Download at C H A P T E R 7 Updating and Deleting Entries In this chapter you ll learn how to modify and delete an existing entry. To accomplish this you need to do the following in your application Create administrative links edit and delete Display the administrative links in Populate the admin form with entry information if you re editing Modify .htaccess to pass a URL to admin .php Check whether submitted form values are edits or new entries Update entries in the entries table Check whether an entry is marked for deletion Remove deleted entries from the entries table Creating Administrative Links Your first task is to create links that will allow you to edit and delete entries. You ll eventually want this to be available to administrators only see Chapter 11 for more information on this topic so you re going to build these links inside a function rather than inline in . Name your function adminLinks and have it accept two arguments the current page page and the URL of the entry you re working with url . To start open up and declare your new function just below retrieveEntries function adminLinks page url Build admin links here The first step in your function is to build the addresses for your links. For your editing link this address simply appends the entry s URL to the end which you ll use later to identify the entry being edited. The path for the link follows .