Easy PHP Websites with the Zend Framework (phần 7)

Tham khảo sách 'easy php websites with the zend framework (phần 7)', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | CHAPTER 12 EXTEND YOUR WEBSITE WITH RSS AND FACEBOOK 281 Figure 12-7. Adding GameNomad s Video Games Tab to a Facebook Profile Configuring the Facebook Application to Support a Tab In the interests of reducing redundant code we re going to reuse the Facebook Controller s profile view which comprises the tools we gave to the logged-in user. To do this just set the Profile Tab URL value Figure 12-8 within the application settings to http gamenomad games. Next set the Profile Tab Name value to Video Games. Profile Tab URL http gamenomad games If ywr applicaton suppons the addition of a profile tab. then specify the URL here where Facebook can fetch the content for profile tabs. This should be relative to your canvas page URL at Facebook. Profile Tab Name video Games The name of your application s tab when a user first adds it to h s profile. Figure 12-8. Configuring the tab URL and name in the application settings Disabling the Authorization Requirement for Tab View Because any Facebook friend could conceivably view the Video Games tab we need to figure out how to disable authorization when any user is viewing the Facebook controller s games method. To do this we ll need to first modify the Facebook Controller s init method to forego authorization of the user when in tabbed mode. Doing so is surprisingly easy because the Facebook platform will automatically set the _POST fb_sig_in_profile_tab variable should a tab page be requested. Therefore all you have to do to forego authorization is check that variable. If not set perform the authorization this- view- onTab isset _POST fb_sig_in_profile_tab if this- view- onTab this- facebook- require_login Rather than just create a local variable the onTab variable was set in the view context in order to later be able to reference it within the Facebook controller s games view. I use the variable to display a special message introducing GameNomad and inviting users to join as well as hide the

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
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.