#5582: Paginate prev/next buttons not working properly
-------------------------------+--------------------------------------------
    Reporter:  benjam          |         Owner:          
        Type:  Bug             |        Status:  reopened
    Priority:  Medium          |     Milestone:  1.2.x.x 
   Component:  Helpers         |       Version:  RC3     
    Severity:  Normal          |    Resolution:          
    Keywords:  paginate links  |   Php_version:  PHP 5   
Cake_version:  1.2.0.7692 RC3  |  
-------------------------------+--------------------------------------------
Changes (by benjam):

  * status:  closed => reopened
  * resolution:  invalid =>

Comment:

 In order to further help explain myself...[[BR]]
 [[BR]]
 And I apologize for not knowing enough about the test suite to build a
 test for this...[[BR]]
 [[BR]]
 Here is some debug code that I placed into the paginator.php file in the
 cake libs:[[BR]]

 {{{
 323             debug($step);
 324             debug($which);
 325             debug($paging);
 326             debug($which == 'Prev' ? $step * -1 : $step);
 327             debug(array('page' => $paging['page'] + ($which == 'Prev'
 ? $step * -1 : $step)));
 328             debug($url);
 329             $url = array_merge(array('page' => $paging['page'] +
 ($which == 'Prev' ? $step * -1 : $step)), $url);
 330             debug($url);
 }}}
 [[BR]]
 [[BR]]
 and here is the output from that code while parsing the Prev link (I was
 on page 2, as the page 1 links worked fine (they would though, because
 there was no page value previously to overwrite the new value)):[[BR]]
 I also modified the output to make what was being output more clear by
 adding the output variable (or expression) to the output.[[BR]]


 {{{
 \cake\libs\view\helpers\paginator.php (line 323)

 $step = 1


 \cake\libs\view\helpers\paginator.php (line 324)

 $which = Prev


 \cake\libs\view\helpers\paginator.php (line 325)

 $paging = Array
 (
     [page] => 2
     [current] => 5
     [count] => 38
     [prevPage] => 1
     [nextPage] => 1
     [pageCount] => 8
     [defaults] => Array
         (
             [limit] => 5
             [step] => 1
             [page] => 1
             [recursive] => 1
             [order] => Array
                 (
                     [((Project.site_id = 1))] => DESC
                     [0] => Project.order
                     [1] => Project.title
                 )

             [conditions] => Array
                 (
                 )

         )

     [options] => Array
         (
             [page] => 2
             [limit] => 5
             [recursive] => 1
             [order] => Array
                 (
                     [((Project.site_id = 1))] => DESC
                     [0] => Project.order
                     [1] => Project.title
                 )

             [conditions] => Array
                 (
                 )

         )

 )


 \cake\libs\view\helpers\paginator.php (line 326)

 ($which == 'Prev' ? $step * -1 : $step) = -1


 \cake\libs\view\helpers\paginator.php (line 327)

 array('page' => $paging['page'] + ($which == 'Prev' ? $step * -1 : $step))
 = Array
 (
     [page] => 1
 )


 \cake\libs\view\helpers\paginator.php (line 328)

 $url = Array
 (
     [page] => 2
 )


 // this is where the url array gets merged with the new page array
 // and should have a new 'page' value of 1 as is in the page array above
 // but you'll note below that the 'page' value in the new $url array is
 // still set at 2


 \cake\libs\view\helpers\paginator.php (line 330)

 $url = Array
 (
     [page] => 2
 )
 }}}[[BR]]
 [[BR]]
 If you require any more assistance, or information from me, please don't
 hesitate.

-- 
Ticket URL: <https://trac.cakephp.org/ticket/5582#comment:5>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design 
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. 
Our primary goal is to provide a structured framework that enables PHP users at 
all levels to rapidly develop robust web applications, without any loss to 
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tickets cakephp" group.
To post to this group, send email to tickets-cakephp@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to