Flickr integration with Symphony
This is an open discussion with 1 reply, filed under XSLT.
Search
Hi Brian,
Thanks for your response. In the end, while waiting for your response, I went with another solution, which doesn’t require a modified pagination utility. You have to edit your datasource file, and make your grab()
function look something like this:
<?php // yadda public function grab(&$param_pool=NULL){ $result = new XMLElement($this->dsParamROOTELEMENT); try{ include(TOOLKIT . '/data-sources/datasource.dynamic_xml.php'); } catch(FrontendPageNotFoundException $e){ // Work around. This ensures the 404 page is displayed and // is not picked up by the default catch() statement below FrontendPageNotFoundExceptionHandler::render($e); } catch(Exception $e){ $result->appendChild(new XMLElement('error', $e->getMessage())); return $result; } // add pagination element preg_match('/<photos page="(?P<page>d+)" pages="(?P<pages>d+)" perpage="(?P<perpage>d+)" total="(?P<total>d+)">/', $result->getValue(), $matches); $result->appendChild(new XMLElement('pagination', NULL, array( 'total-entries' => $matches['total'], 'total-pages' => $matches['pages'], 'entries-per-page' => $mathces['perpage'], 'current-page' => $matches['page'], ))); if($this->_force_empty_result) $result = $this->emptyXMLSet(); return $result; } // yadda ?>
I don’t know if this is recommended or not, but it works fine. It adds a pagination element to the result, which can be used by the pagination utility by Nick and Nils.
Thanks for your help though,
- Bjorn
Create an account or sign in to comment.
Over on Flickr, Bjorn wrote:
Hi Bjorn,
I’ll do my best to explain it. I don’t think it’s too complicated, but I’ve never tried documenting my Symphony projects. Hopefully this will make sense.
As you mentioned, I started with a Dynamic Datasource, like this:
URL
Included Elements
Once it’s attached to my page, I have a template like this (HTML5, edit as needed):
Also attached to the page is a Flickr pagination utility. I never updated the comments, but it is a modified version of Nick’s pagination utility.
I’m using the query string for the pagination count, but now I wish I’d used a parameter. Someday I’ll get around to changing it.