Ticket #1753 (closed defect: fixed)

Opened 4 years ago

Last modified 10 months ago

SGL_DB>getPagedData returns incorrectly formatted links

Reported by: shaunmza Assigned to: demian
Priority: normal Milestone: 1.0
Component: SGL - DB Severity: open
Keywords: db, pagination, getpageddata Cc:

Description

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)

Attachments

DB.php.diff (0.6 kB) - added by shaunmza on 09/19/11 13:49:38.
Diff file for DB.php that fixes pagination

Change History

03/25/10 14:42:42 changed by 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.

09/19/11 13:49:38 changed by shaunmza

  • attachment DB.php.diff added.

Diff file for DB.php that fixes pagination

09/19/11 13:53:27 changed by shaunmza

  • keywords changed from finder, cms, pagination to db, pagination, getpageddata.
  • owner changed from demian to somebody.
  • component changed from module - cms to SGL - DB.
  • summary changed from CMS Finder Paginate returns incorrectly formatted links to SGL_DB>getPagedData returns incorrectly formatted links.

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

09/19/11 13:54:30 changed by shaunmza

  • owner changed from somebody to demian.

01/03/13 10:50:15 changed by demian

  • status changed from new to closed.
  • resolution set to fixed.

(In [4432]) addressing pagination bug, fixes #1753

01/03/13 10:50:55 changed by demian

Nice one Shaun, applied, thanks.