Re: 1.2 Pagination forgetting conditions?

2007-02-23 Thread NOSLOW

I found that if you have other params set (field sort, direction,
order), then you need to also unset those as well:

unset($this-params['pass']['page']);
unset($this-params['pass']['sort']);
unset($this-params['pass']['direction']);
unset($this-params['pass']['order']);

Other wise you can't page and retain the same sort order.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: 1.2 Pagination forgetting conditions?

2007-02-23 Thread Cynthia

I like using the session to carry over some parameters paginate would
otherwise forget about :)

On Feb 23, 7:27 pm, NOSLOW [EMAIL PROTECTED] wrote:
 I found that if you have other params set (field sort, direction,
 order), then you need to also unset those as well:

 unset($this-params['pass']['page']);
 unset($this-params['pass']['sort']);
 unset($this-params['pass']['direction']);
 unset($this-params['pass']['order']);

 Other wise you can't page and retain the same sort order.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: 1.2 Pagination forgetting conditions?

2007-02-07 Thread Preloader

Hello Chris,

Yesterday I had the same problem, when programming a fulltext search.
Should also work for filtering.

I solved it this way:

// this is my search action in my controller
function search(){
// if I got a search text string from the form, then overwrite
if (!empty($this-params['form']['searchtext'])){
  $this-params['pass']['searchtext'] = $this-params['form']
['searchtext'];
}

if(!empty($this-params['pass']['searchtext'])){
  // process search text string, building conditions and query the
results
}else{
  // no search text typed in
}
}


... and in the view ...
// reset the page parameter before printinge next/prev links,
otherwise pagination doesn't work correctly
unset($this-params['pass']['page']);

// It's important, that you pass $this-params['pass'] as the url to
the next/prev links:

print $paginator-prev('', array('url' = $this-params['pass']),
null, array('class' = 'disabled'));
print $paginator-next('', array('url' = $this-params['pass']),
null, array('class' = 'disabled'));


This works fine for me, I hope, this helps!

Greets, Christoph


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---