tailieunhanh - Thiết kế mạng xã hội với PHP - 17
Mặc dù người sử dụng thông tin là có được chia thành các khu vực khác nhau, được truy cập thông qua liên kết khác nhau cho thấy các trang khác nhau, sẽ có một số thông tin cần được phổ biến khắp tất cả các khía cạnh, chẳng hạn như: • • • Tên của người sử dụng có hồ sơ chúng tôi đang xem bức ảnh của họ Một mẫu của bạn bè | 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 Wow eBook 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
đang nạp các trang xem trước