简体   繁体   中英

Facebook php sdk 5.0 next page

The Facebook/Facebook Class got the method next in order to get the next page.

In my case I get a list of all albums, want to loop over all albums and find the id of the cover photos album. SOme pages got more than 25 Albums, so i need pagination.

But the next method is requesting a GraphEdge. What should I hand over?

(I'll just copy my answer from the FB Deveopers group here, so the question has an answer; and it might perhaps help other people in the future as well.)

[I] want to loop over all albums and find the id of the cover photos album. SOme pages got more than 25 Albums, so i need pagination.

I think you can have that without pagination: Instead of going through all the user's albums, request their cover photo – and then look what album that is in.

/me?fields=cover – gets you the id of the cover photo.
Then use that id to request the album – /123456789?fields=album


I didn't find a way to merge those two into one request using Field Expansion, that doesn't seem to work with the CoverPhoto node type (or I didn't get the syntax right) – but still, two requests (and the first one you'd probably be making anyway, to get other user details) seems a lot better than having to loop over all albums and compare their names, and on top of that having to deal with possible pagination.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM