PHP for Absolute Beginners PHẦN 8

Trong chương này, bạn sẽ tìm hiểu làm thế nào để chỉnh sửa và xóa mục nhập hiện có. Để thực hiện điều này, bạn cần phải làm như sau trong ứng dụng của bạn: • Tạo liên kết hành chính (chỉnh sửa và xóa) • Hiển thị các liên kết hành chính trong • nhất các hình thức quản trị với các thông tin nhập cảnh nếu bạn đang chỉnh sửa • | CHAPTER 9 SYNDICATING THE BLOG Remove the fulldisp flag array_pop e Perform basic data sanitization e sanitizeData e Add a content type header to ensure proper execution header Content-Type application rss xml Output the XML declaration echo xml version encoding UTF-8 n rss version channel title My Simple Blog title link http localhost simple_blog link description This blog is awesome. description language en-us language channel rss At this point you have an array that contains your entries ready for output. You use a foreach loop to display each entry. Begin by generating an item with a title a description and a link. The only extra step is to escape all HTML entities in your description you need to convert special characters to their HTML entity equivalents such as to lt . This is necessary because unescaped HTML will cause an error for RSS readers. You accomplish this by calling htmlentities on the contents of the entry column. Add the following code in bold to php Include necessary files include_once . inc include_once . inc Open a database connection db new PDO DB_INFO DB_USER DB_PASS Load all blog entries e retrieveEntries db blog 268 Download at CHAPTER 9 SYNDICATING THE BLOG Remove the fulldisp flag array_pop e Perform basic data sanitization e sanitizeData e Add a content type header to ensure proper execution header Content-Type application rss xml Output the XML declaration echo xml version encoding UTF-8 n rss version channel title My Simple Blog title link http localhost simple_blog link description This blog is awesome. description language en-us language php Loop through the entries and generate RSS items foreach e as e Escape HTML to avoid errors entry htmlentities e entry Build the full URL to the entry url http localhost simple_blog blog . e url item title php echo e title title description php echo entry description link php echo url link item php endforeach channel rss Download at

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã 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.