Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
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/list.tpl.php Views/default/templates/members/search.tpl.php 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/ profileinformationcontroller.php) 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 list.tpl.php Views default templates members search.tpl.php 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 profileinformationcontroller.php 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 www.eBookTM.com 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 header.tpl.php profile information view.tpl.php footer. tpl.php get all the profile information and send it to the template require_once FRAMEWORK_PATH . models profile.php 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 view.tpl.php the highlighted aspects show the common template information .