demianturner / sgl-docs-tickets-migration-test

0 stars 0 forks source link

SGL_DB>getPagedData returns incorrectly formatted links #1753

Open demianturner opened 11 years ago

demianturner commented 11 years ago

Below is sample of code used CMS v 1.7.1

//Start

$aPagerOptions = array( 'mode' => 'Sliding', 'delta' => 3, 'separator' => '', 'nextImg' => '', 'altNext' => '', 'perPage' => 1, ); $list ->paginate($aPagerOptions); $oContent = $list->retrieve(); $pager = $list->getPager(); if ($pager) { $output->pageLinks = $pager->pageLinks; $output->resPerPage = $pager->_perPage; } $output->result = $oContent;

//End

$output->pageLinks takes the current url and appends an additional '/' before adding the pageId (i.e. http://mypage/index.php/cms/contentview/action/list/frmContentTypeId/5/ will have a page 2 link of http://mypage/index.php/cms/contentview/action/list/frmContentTypeId/5//pageId/2/)

This is repeated if you click on the second page repeatedly (i.e. it keeps adding slashes)

demianturner commented 11 years ago

[shaunmza] Applied this fix on my side, do not know if it is correct though...

In the 'setPager' method in modules/cms/lib/SGL/Finder.php I changed;

$this->pager->pageLinks = str_replace( '/pageId/' . $this->pager->getCurrentPageID() . '/', '/', $this->pager->links);

to the following;

$this->pager->pageLinks = str_replace( '/pageId/' . $this->pager->getCurrentPageID() . '/', '', $this->pager->links);

And now my pagination is working.

demianturner commented 11 years ago

[shaunmza] Have added a diff file that seems to fix it on my side, please consider applying as a patch.