TAILIEUCHUNG - Thiết kế mạng xã hội với PHP - 37

Bây giờ chúng ta có chức năng cho các nhóm tại chỗ, chúng ta cần một cơ sở để cho phép người dùng của chúng tôi để có thể tìm thấy và tham gia nhóm. Sau khi tất cả, nếu người dùng không thể tìm thấy các nhóm sau đó không có nhiều điểm trong họ đang có. Điều này có thể được kích hoạt thông qua hai phương pháp: Liệt kê các nhóm (nơi công cộng) nhóm tìm kiếm (một lần nữa, nơi công cộng). | Groups Groups Now that we have functionality for groups in place we need a facility to allow our users to be able to find and join groups. After all if users can t find groups then there isn t much point in them being there. This can be enabled through two methods Listing groups where they are public Searching groups again where they are public To facilitate this we will need a new model and a new controller groups. This will manage the listing and searching of groups. Listing groups Let s look at how we can list public groups and also list our own group memberships to make it possible to find groups and easily access groups we are members of. Group controller addition We need to complete a method we referenced earlier in the chapter to list public groups. As it takes an offset as a parameter it should build a paginated list of public groups. private function listPublicGroups offset sql SELECT FROM groups WHERE active 1 AND type private require_once FRAMEWORK_PATH . lib pagination pagination new Pagination this- registry pagination- setQuery sql pagination- setOffset offset pagination- setLimit 20 pagination- setMethod cache pagination- generatePagination if pagination- getNumRowsPage 0 this- registry- getObject template - buildFromTemplates groups else this- registry- getObject template - buildFromTemplates ---------------------------------- 342 ---------------------------------- Download from Wow eBook Chapter 10 groups this- registry- getObject template - getPage - addTag groups array SQL pagination- getCache this- registry- getObject template - getPage - addTag page_number pagination- getCurrentPage this- registry- getObject template - getPage - addTag num_pages pagination- getNumPages if pagination- isFirst this- registry- getObject template - getPage - addTag first this- registry- getObject template - getPage - addTag previous .

Đã 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.