tailieunhanh - Tạo mạng xã hội với PHP - part 26
Statuses—Other Media Changes to the view Since all of the media types we are going to support require at least one additional database field in a table that extends the statuses table, we are going to need to display any additional fields on the post status form. The standard type of status doesn't require additional fields, and new media types that we haven't discussed, which we may wish to support in the future, may require more than one additional field. To support a varying number of additional fields depending on the type, we could use some JavaScript (in this case, we will. | Statuses Other Media Changes to the view Since all of the media types we are going to support require at least one additional database field in a table that extends the statuses table we are going to need to display any additional fields on the post status form. The standard type of status doesn t require additional fields and new media types that we haven t discussed which we may wish to support in the future may require more than one additional field. To support a varying number of additional fields depending on the type we could use some JavaScript in this case we will use the jQuery framework to change the form depending on the context of the status. Beneath the main status box we can add radio buttons for each of the status types and depending on the one the user selects the JavaScript can show or hide the additional fields making the form more relevant. Template Our update status template needs a few changes We need to set the enctype on the form so that we can upload files for posting images We need radio buttons for the new types of statuses We need additional fields for those statuses The changes are highlighted in the following code segment p Tell your network what you are up to p form action profile statuses profile_user_id method post enctype multipart form-data textarea id status name status textarea br input type radio name status_type id status_checker_update class status_checker value update Update input type radio name status_type id status_checker_video class status_checker value video Video input type radio name status_type id status_checker_image class status_checker value image Image input type radio name status_type id status_checker_link class status_checker value link Link br div class video_input extra_field label for video_url class YouTube URL label input type text id name video_url class br div div class image_input extra_field ---------------------------------- 232 ----------------------------- Download from Chapter 8 .
đang nạp các trang xem trước