TAILIEUCHUNG - Beginning Zend Framework phần 8

Một khi các giá trị cấu hình được thiết lập, bạn có thể tạo ra các đối tượng bằng cách trong tên máy chủ SMTP như giá trị ban đầu và thông tin cấu hình như giá trị thứ ý cài đặt e-mail cũng có thể được thiết lập như là tài sản thể hiện của bộ điều khiển và tái sử dụng trong suốt | CHAPTER 7 WEB SERVICES AND FEEDS try flickr new Zend_Service_Flickr API_KEY get the photos. options array per_page 10 photos flickr- tagSearch artist options this- view- photos photos catch Exception e throw e You create an instance of the Zend_Service_Flickr object flickr pass in the developer key and call the tagSearch REST web service method. By using the tagSearch method you fetch all the photos that have been tagged with the artist s name and expect a Zend_Service_Flickr_ResultSet object returned. Finally you pass the object into the view. Listing 7-15 shows the file that you should save in application views scripts artist. Listing 7-15. php echo this- doctype XHTML1_STRICT html xm lns http 1999 xhtml xml lang en lang en head php echo this- headTitle - Flick Photos head body php echo this- render includes body php if this- photos- totalResults 0 foreach this- photos as photo thumbnail photo- Thumbnail- uri original photo- Original- uri php if empty origin a href php echo original php img src php echo thumbnail 276 Download at CHAPTER 7 WEB SERVICES AND FEEDS php a php php else We re sorry there were no photos available. php body html The foundation of the view can be taken from any of the other examples. Take a look at Listing 712 you can use the same markup as . You want it compact enough to fit anywhere but also able to display enough photos so that the module makes sense to have. You start off by seeing whether the result set this- photos contains any photos. This allows you to display a friendly message to the user if there are no photos. If there are photos go ahead and create the layout. Create a foreach loop that loops though the result set in the middle of the layout to retrieve the Zend_Service_Flickr_Result and then Zend_Service_Flickr_Image objects. You primarily use the Small portions of the result object and the image location for display. You also

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