Đang chuẩn bị liên kết để tải về tài liệu:
Practical Web 2.0 Applications with PHP phần 2

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

9. Thay đổi các đối số phương pháp settable () bằng cách thêm 0 như là đối số thứ hai như thế này: $ xml-settable (blog ', 0) 10. Lưu trang, và thử nghiệm nó một lần nữa. Lần này, Lưu generate_rss.php, và tải nó vào một trình duyệtVí dụ 4-22 cho thấy các nội dung của register.tpl người dùng | Simpo PDF Merge and Split Unregistered Version - http www.simpopdf.com CHAPTER 2 SETTING UP THE APPLICATION FRAMEWORK 39 Integrating Smarty with the Web Site Controllers Finally we need to make Zend_Controller use the Templater class instead of its default Zend_View class. To do this we must use the following code which we will shortly add to the application bootstrap file vr new Zend_Controller_Action_Helper_ViewRenderer vr- setView new Templater vr- setViewSuffix tpl Zend_Controller_Action_HelperBroker addHelper vr Note that we must call setViewSuffix to indicate that templates finish with a file extension of .tpl. By default Zend_View will use the extension .phtml. Listing 2-12 shows how the controller part of index.php looks once this code has been added. Listing 2-12. TellingZend_Controller to Use Smarty Instead of its Default View Renderer index.php php . other code handle the user request controller Zend_Controller_Front getInstance controller- setControllerDirectory config- paths- base . include Controllers setup the view renderer vr new Zend_Controller_Action_Helper_ViewRenderer vr- setView new Templater vr- setViewSuffix tpl Zend_Controller_Action_HelperBroker addHelper vr controller- dispatch Note Viewing the web site now will still display the Web site home message. However a Smarty error will occur since we haven t yet created the corresponding template file for the index action of the index controller. Now whenever a controller action is executed Zend_Controller will automatically look for a template based on the controller and action name. Let s use the index action of the index controller as an example as shown in Listing 2-13. Simpo PDF Merge and Split Unregistered Version - http www.simpopdf.com 40 CHAPTER 2 SETTING UP THE APPLICATION FRAMEWORK Listing 2-13. Our New Index Controller Now Outputting the index.tpl File IndexController.php php class Indexcontroller extends CustomControllerAction public function indexAction When you open http phpweb20

Đã 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.