I'm assuming you meant $this->params['paging']

Here it is from page 1:

2007-01-26 15:54:46 Error: Array
(
    [Thing] => Array
        (
            [page] => 1
            [current] => 3
            [count] => 514
            [prevPage] =>
            [nextPage] => 1
            [pageCount] => 172
            [defaults] => Array
                (
                    [limit] => 3
                    [step] => 1
                    [order] => Array
                        (
                            [Thing.created] => desc
                        )

                    [conditions] => Array
                        (
                        )

                )

            [options] => Array
                (
                    [limit] => 3
                    [order] => Array
                        (
                            [Thing.created] => desc
                        )

                )

        )

)


And here it is from page 2:

2007-01-26 15:54:49 Error: Array
(
    [Thing] => Array
        (
            [page] => 2
            [current] => 3
            [count] => 514
            [prevPage] => 1
            [nextPage] => 1
            [pageCount] => 172
            [defaults] => Array
                (
                    [limit] => 3
                    [step] => 1
                    [order] => Array
                        (
                            [Thing.created] => desc
                        )

                    [conditions] => Array
                        (
                        )

                )

            [options] => Array
                (
                    [limit] => 3
                    [order] => Array
                        (
                            [Thing.created] => desc
                        )

                    [page] => 2
                )

        )

)



On 1/26/07, nate <[EMAIL PROTECTED]> wrote:
>
> Yeah, you could just... um, wait, nevermind.  Sorry, no ideas.
>
> Do an array dump of $paginator->paging on page 2, and see what that
> gives you.
>
> On Jan 26, 2:49 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> > OK here's a simple example showing that $paginator->next() and
> > $paginator->prev() are generating incorrect page numbers:
> >
> > things table
> > CREATE TABLE  `things` (
> >   `id` int(10) unsigned NOT NULL auto_increment,
> >   `name` varchar(30) default '',
> >   `attribute1` int(11) default '0',
> >   `created` datetime default '0000-00-00 00:00:00',
> >   `modified` datetime default '0000-00-00 00:00:00',
> >   PRIMARY KEY  (`id`)
> > ) ENGINE=MyISAM DEFAULT CHARSET=utf8
> >
> > app/models/things.php
> > <?php
> >
> > class Thing extends AppModel
> > {
> >         var $name = 'Thing';
> >
> > }?>
> >
> > app/controllers/things_controller.php
> > <?php
> >
> > class ThingsController extends AppController
> > {
> >         var $name = 'Things';
> >         var $scaffold;
> >         var $paginate = array('limit' => 3, 'order' => array('Thing.created'
> > => 'desc'));
> >
> >         function index($attribute1)
> >         {
> >                 $this->set('things', $this->paginate('Thing',
> > array('Thing.attribute1' => $attribute1)));
> >         }
> >
> >         //just generates some random things to populate the things table
> >         function generate($count)
> >         {
> >                 for ($i = 0; $i < $count; $i++)
> >                 {
> >                         $thing = array();
> >                         $thing['Thing']['attribute1'] = rand(1, 20);
> >                         $thing['Thing']['attribute2'] = rand(1, 20);
> >                         $thing['Thing']['attribute3'] = rand(1, 20);
> >                         $str = '';
> >                         for ($j=1; $j<=10; $j++){
> >                                 $set = array(rand (65,90),rand(97,122));
> >                                 $str .= chr($set[rand(0,1)]);
> >                         }
> >                         $thing['Thing']['name'] = $str;
> >                         $this->Thing->create();
> >                         $this->Thing->save($thing);
> >                 }
> >         }
> >
> > }?>
> >
> > app/views/things/index.ctp
> > <p><?php echo $paginator->counter(); ?></p>
> > <p><?php echo $paginator->prev('<< Previous', array('url' =>
> > $this->params['pass']), null, array('class' => 'disabled')); ?></p>
> > <p><?php echo $paginator->next('Next >>', array('url' =>
> > $this->params['pass']), null, array('class' => 'disabled')); ?></p>
> > <table>
> >         <thead>
> >                 <tr>
> >                         <th>id</th>
> >                         <th>name</th>
> >                         <th>attribute1</th>
> >                         <th>created</th>
> >                         <th>modified</th>
> >                 </tr>
> >         </thead>
> >         <tbody>
> >                 <?php foreach($things as $thing): ?>
> >                         <tr>
> >                                 <td><?php echo $thing['Thing']['id']; 
> > ?></td>
> >                                 <td><?php echo $thing['Thing']['name']; 
> > ?></td>
> >                                 <td><?php echo 
> > $thing['Thing']['attribute1']; ?></td>
> >                                 <td><?php echo $thing['Thing']['created']; 
> > ?></td>
> >                                 <td><?php echo $thing['Thing']['modified']; 
> > ?></td>
> >                         </tr>
> >                 <?php endforeach; ?>
> >         </tbody>
> > </table>
> >
> > So basically the things index method takes one parameter which it uses
> > to filter the displayed things (think of it as a search parameter).
> > I'm using $paginator->next('Next >>', array('url' =>
> > $this->params['pass'])) as suggested, but on page 2 the next and
> > previous links both point again to page 2, not page 1 and 3 as
> > expected.
> >
> > Is this a bug or am I doing something wrong?
> >
> > On Jan 26, 1:51 pm, "Zach Cox" <[EMAIL PROTECTED]> wrote:
> >
> > > I'm using the 2007.01.24 nightly build.  I think I have arguments
> > > getting to my action method succesfully, but I'm still confused as to
> > > why $paginator->next() and $paginator->prev() are generating incorrect
> > > page numbers.
> >
> > > Any ideas?
> >
> > > On 1/26/07, nate <[EMAIL PROTECTED]> wrote:
> >
> > > > It's better to pass URL parameters as arrays.  Paginator has better
> > > > support for building URLs from arrays than it does from strings.
> >
> > > > On Jan 26, 1:35 pm, "dkarlson" <[EMAIL PROTECTED]> wrote:
> > > > > BTW -- I use the $paginator->next/prev links like so:
> > > > > $paginator->prev('Previous', array('url' => $config['Config']['id']),
> > > > > null, array('class' => 'disabled'));
> >
> > > > > It creates nice links like this: controller/action/url/page
> > > > > Does this make sense?
> >
> > > > > HTH,
> > > > > D
> >
> > > > > On Jan 26, 12:32 pm, "dkarlson" <[EMAIL PROTECTED]> wrote:
> >
> > > > > > If you're using 1.2.0.4206, you might want to grab the latest 
> > > > > > nightly
> > > > > > or checkout the 1.2 branch from svn.https://trac.cakephp.org/
> >
> > > > > > On Jan 26, 10:21 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > OK so doing:
> >
> > > > > > > $paginator->next('Next>>', $this->params['pass'])
> >
> > > > > > > which creates urls like
> >
> > > > > > > /controller/action/page:2/param1/param2
> >
> > > > > > > seems to work with my action like
> >
> > > > > > > function action($param1, $param2)
> > > > > > > {
> >
> > > > > > > }I get the first page just fine, then clicking Next link to 2nd 
> > > > > > > page
> > > > > > > also looks fine.  But on page 2, the Next link still points to 
> > > > > > > page:2.
> > > > > > > And then the Previous link on page 2 also points to page:2.
> >
> > > > > > > Any idea why it's not correctly computing next & previous page 
> > > > > > > numbers
> > > > > > > for the next & previous links?
> >
> > > > > > > On Jan 26, 10:16 am, "Zach Cox" <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > > I'd really like to avoid this:
> >
> > > > > > > > function action($pagingStuff, $param1, $param2)
> > > > > > > > {
> >
> > > > > > > > }Am I missing something?  The whole point of this is to 
> > > > > > > > paginate search
> > > > > > > > results while avoiding POSTed variables.
> >
> > > > > > > > On 1/26/07, AD7six <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > > > On Jan 26, 1:42 pm, "Zach Cox" <[EMAIL PROTECTED]> wrote:
> > > > > > > > > > That's closer but it still doesn't work right, it produces:
> >
> > > > > > > > > > /controller/action/page:2/param1/param2
> >
> > > > > > > > > > Is there any way to get $paginator->next() to put the action
> > > > > > > > > > parameters *before* the pagination parameters?
> >
> > > > > > > > > Why? Given the position of named parameters are somewhat 
> > > > > > > > > irrelavent,
> > > > > > > > > what problem is that causing you?
> >
> > > > > > > > > Cheers,
> >
> > > > > > > > > AD7six
> > > > > > > > > Please note:
> > > > > > > > > The manual/bakery is a good place to start any quest for info.
> > > > > > > > > The cake search (at the time of writing) erroneously reports 
> > > > > > > > > less/no
> > > > > > > > > results for the google group.
> > > > > > > > > The wiki may contain incorrect info - read at your own risk 
> > > > > > > > > (it's
> > > > > > > > > mainly user submitted) :) You may get your answer quicker by 
> > > > > > > > > asking on
> > > > > > > > > the IRC Channel (you can access it with just a browser
> > > > > > > > > here:http://irc.cakephp.org).
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to