tailieunhanh - Thiết kế mạng xã hội với PHP - 22
Tham khảo tài liệu 'thiết kế mạng xã hội với php - 22', công nghệ thông tin, đồ họa - thiết kế - flash phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Status Stream stream- . data ID stream types . data type_reference . datatags elseif data poster data profile this- registry- getObject template - addTemplateBit stream- . data ID stream types . data type_reference . datatags else network updates this- registry- getObject template - addTemplateBit stream- . data ID stream types . data type_reference . . datatags else If there were no updates we display the none template. this- registry- getObject template - buildFromTemplates stream So if we had our templates in place at this stage bringing all of this together adding the controller to our database and viewing stream what would we see 192 Download from Wow eBook Chapter 6 This is the basics of our status stream. We can now look at adding comments likes and dislikes to the stream. Comments likes and dislikes The functionality behind adding comments likes and dislikes is very similar to the work we did in Chapter 5 in developing the statuses on a user s profile. The concept to adding these to the stream is fairly straightforward. Firstly we create an empty array of comments likes dislikes for each status. This way if a post has no comments likes or dislikes then by caching the empty array and sending it to the template we don t see a blank list where comments should be. If there are comments they are added to the empty array making it non-empty cached and sent to the template. Although the method is the same for the three aspects comments require one database query whereas likes and dislikes combined require another so let s add in support one at a time. Comments Take the status IDs we retrieved earlier and create empty arrays for each of them. status_ids implode IDs start array foreach IDs as id start id array Copy our new array of empty arrays to be used for comments. comments comments start Query the database for comments. sql SELECT as commenter .
đang nạp các trang xem trước