Simple way to use Zend_Service_Flickr and Zend_Paginator. I came across this somewhere and I think it may come in handy to anyone trying to through between the results of a Flickr search.
$flickr = new Zend_Service_Flickr($key); $items = $this->_getParam('items', 10); $page = $this->_getParam('page', 1); $keyword = $this->_gerParam('keyword'); $images = $flickr->tagSearch( urldecode($keyword), array( 'per_page' => $items, 'page' => $page ) ); $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Null($images->totalResultsAvailable)); $paginator->setCurrentPageNumber($page); $paginator->setItemCountPerPage($items); $this->view->images = $images; $this->view->paginator = $paginator;
The above snippet could be added in a Controller Action expecting ‘items’ (how many items to return per page), ‘keyword’ (the keyword to search by) and ‘page’ (which page we are currently at)
Cheers to Zend Framework!
0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.