tailieunhanh - Beginning PHP and MySQL From Novice to Professional phần 7
Kịch bản này tạo ra một tiêu đề xem tài sản được đặt tên sẽ được sử dụng để gán tiêu đề của trang web. Cuối cùng, tạo ra một bộ điều khiển, , dự định để hiển thị thông tin cần thiết cho mục đích của trang web, và vì lợi ích của cuộc biểu tình như gói Xác nhận PEAR (xem ) | 614 CHAPTER 24 MVC AND THE ZEND FRAMEWORK Accessed through http public function indexAction this- view- title Welcome to Our Chess Club Web Site This script creates a view property named title that will be used to assign the Web page s title. Finally create one more controller intended to display information pertinent to the Web site s purpose and for sake of demonstration some information about the visiting user. This controller is displayed in Listing 24-3. Listing 24-3. The AboutController Controller php Load the Zend_Controller_Action class require_once Zend Controller class AboutController extends Zend_Controller_Action Accessed through http about public function indexAction this- view- title About Our Chess Club Accessed through http about you public function youAction Page title this- view- title About You CHAPTER 24 MVC AND THE ZEND FRAMEWORK 615 Retrieve the user s IP address this- view- ip _SERVER REMOTE_ADDR Retrieve browser information this- view- browser _SERVER HTTP_USER_AGENT Creating the Views Next create the views that correspond to these three actions one for the home page one for the about page and one for the about you page. Place the homepage view in the directory application modules default views scripts index and the other two in application modules default views scripts about . These views are presented in Listings 24-4 24-5 and 24-6 respectively. Each of these views is intended to demonstrate different facets of the behavior of views. Listing 24-4. The View php echo this- render div id header Next Chess Club Meeting April 12 div p Welcome to our Chess Club s Web site We re a bunch of chess enthusiasts who travel the globe in search of worthy opponents. Join us at our next meeting held at the coffee shop on the corner of Third and Neil each Tuesday at 6 . p php echo this- render
đang nạp các trang xem trước