Tạo mạng xã hội với PHP - part 18

Profiles and Statuses Profile link The link to view a user's profile will simply be: profile/view/userid,. This enacts the profile controller, which in turn passes control to the profile information controller. We need to add this link to the following templates we already have: • • Views/default/templates/members/ Views/default/templates/members/ The link is shown below: DINO SPACE! Members List {letter} {name} Keeper of {dino_name} a {dino_gender} {dino_breed} {form_relationship} The profile information controller (controllers/profile/ ) needs to communicate with the model, Controller to get the data for the profile, and have the data assigned to template variables. We already have a method in the controller to do this,. | Profiles and Statuses Profile link The link to view a user s profile will simply be profile view userid . This enacts the profile controller which in turn passes control to the profile information controller. We need to add this link to the following templates we already have Views default templates members Views default templates members The link is shown below h1 DINO SPACE Members List letter h1 -- START members -- p strong a href profile view lD name a strong p p Keeper of strong dino_name strong a strong dino_gender dino_breed strong p form_relationship hr -- END members -- Controller The profile information controller controllers profile needs to communicate with the model to get the data for the profile and have the data assigned to template variables. We already have a method in the controller to do this so it should be a fairly trivial task include the model and call the toTags method to push the profile information to template tags as highlighted in the code below php Profile information controller class Profileinformationcontroller Constructor param Registry registry @param int user the user id return void public function __construct registry user this- registry registry this- viewProfile user ---------------------------------- 152 -------------------------------- Download from Chapter 5 View a users profile information @param int user the user id return void private function viewProfile user load the template this- registry- getObject template - buildFromTemplates profile information footer. get all the profile information and send it to the template require_once FRAMEWORK_PATH . models profile new Profile this- registry user profile- toTags p_ Template The template for this aspect of the profile is shown below views default templates profile information the highlighted aspects show the common template information .

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.