开发者

CakePHP url path data in with pagination on first search (what am I doing wrong?)

开发者 https://www.devze.com 2023-02-24 02:43 出处:网络
I have a search form. The form values are passed to query and results are displayed as expected. I am using Cakes built in pagination methods.

I have a search form.

The form values are passed to query and results are displayed as expected.

I am using Cakes built in pagination methods.

On the initial search, I need the url to reflect the search path values as when I use the sort() or Next >> pagination methods.

When I use sort() or Next >>, my url is formatted with the paginator structure like:

   // pagination to Next page note Page 2
...plans/search/55/22/1/0/33758/page:2 

When I do the first search I get url:

...plans/search/

Here are the appropriate fragments of my search action:

function search开发者_开发知识库( 
...
// query and other action code here unrelated to pagination 
...
// start of applicable array and pagination code
$url = array('controller' => 'plans', 'action' => 'search');
$this->paginate = $options; // $options is my query
$this->set('searchdetails', array_merge($url, $searchdetails)); //$searchdetails isi  any array of the values entered in the search input boxes. Joining my url and search details.
$this->set('plans', $this->paginate('Plan'));

I tried to break down the above to ONLY include what is applicable to my problem.

NOTE: I am running a default "order" through this action in my query and its working fine, but is not reflected in the url.

I need to know how to update the url to reflect the initial search input results. I have ALL of the array data passed to my view just fine.

I tried recreating the path with a rather large method I wrote, but it did nothing but complicate my problem...

Is there a simple Cake type solution for this? Or is this just not in Cakes cards currently?

Please set me straight on this.


Have you tried

echo $this->Form->create(null, array('url' => $this->passedArgs)); 
0

精彩评论

暂无评论...
验证码 换一张
取 消