Hey guys, I hate to ask a ridiculous question, but for the life of me I can''t figure this out. I followed the flickr.rb screencast, and now I''m trying to modify it, but I can''t figure out how to paginate photos. In other words, I want it to only display 10 photos (:per_page => ''10''), but then I want to be able to page back and forth to see the rest. Anyone done anything similar? I''ve been looking for quite some time now. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jonathan Barket wrote:> In other words, I want it to only display 10 photos (:per_page => ''10''), > but then I want to be able to page back and forth to see the rest.Hey Jonathan, This is something I had thought of doing, but hadn''t looked into just now. You can specify which page you want by using :page => ''x'' symbol. I''ve not tried this, but it should work according to the Flickr API docs. The API docs for flickr.rb aren''t the best, but more detail on the methods and their arguments can be found in the flickr API docs themselves. Here''s the relevant page for your query: http://www.flickr.com/services/api/flickr.photos.getRecent.html Hope that helps. Dougal. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Nov 12, 2006, at 17:08 , Jonathan Barket wrote:> I hate to ask a ridiculous question, but for the life of me I can''t > figure this out. I followed the flickr.rb screencast, and now I''m > trying > to modify it, but I can''t figure out how to paginate photos. > In other words, I want it to only display 10 photos (:per_page => > ''10''), > but then I want to be able to page back and forth to see the rest. > Anyone done anything similar? I''ve been looking for quite some time > now.If you take a look at flickr.rb, you''ll find its photos method simply collects the photo ids returned by the Flickr method flickr.photos.search. That Flickr method actually provides you with the total number of matched items, but this information is not used by flickr.rb. You may want to modify the photos method a bit so that it returns that number (and perhaps other pagination info too, along with the photos). Then just as Dogulas Shearer has said, you can go back and forth using the page parameter. d. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---