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

Profiles and Statuses require_once( FRAMEWORK_PATH . 'controllers/profile/ ' ); $sc = new Profilestatusescontroller( $this-registry, true, $user ); } If the user tried to access a sub-controller that doesn't exist, we would display an error. /** * Display an error - you cannot access profiles simply by visiting /profile/ ! * @return void */ private function profileError() { $this-registry-errorPage( 'Sorry, an error has occured', 'The link you followed was invalid, please try again'); } } ? Core shared information Although the user's profile is going to be broken down into different areas, which are accessed through different links showing different pages, there will be some. | Profiles and Statuses require_once FRAMEWORK_PATH . controllers profile sc new Profilestatusescontroller this- registry true user If the user tried to access a sub-controller that doesn t exist we would display an error. Display an error - you cannot access profiles simply by visiting profile return void private function profileError this- registry- errorPage Sorry an error has occured The link you followed was invalid please try again Core shared information Although the user s profile is going to be broken down into different areas which are accessed through different links showing different pages there will be some information that should be common throughout all of these aspects such as The name of the user whose profile we are viewing Their photograph A sample of their friends This core shared information is something we can generate from within the profile controller which is called regardless of which sub controller control is subsequently delegated to. This information can be generated and sent to the template handler ready for when the page is outputted to the user s browser. Name ID and photograph To get the name ID and photograph of a user we are going to require a profile model to access and manage the data from a user s profile. We are also going to need to add a new field to our profile table one for a user s profile picture as we didn t consider that when the user signed up to Dino Space . While we are creating this model we should also create a field in the database for the users biography information for them to tell everyone about themselves. ----------------------------------- 142 ----------------------------------- Download from Chapter 5 Profile model We need to create a profile model models which we will need to do the following things Populate its fields based on a user s profile in the database Update its fields based on changes to a user s profile Update the corresponding database .

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
100    95    3    28-06-2024
94    829    36    28-06-2024
Đã 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.