bigmike7801
bigmike7801

Reputation: 3970

CakePHP: Remove "page:#" from url params

I have a search form using the get method. The form works fine until I use it after paginating through the results.

Users can enter the site from any number of urls that look like domain.com/serach/results/something/something_else/ the important part is the domain.com/serach/results/.

Here's what my code for the the form looks like:

echo $this->Form->create(null, array(
    'type' => 'get',
    'url' => $this->Html->url(null, true),
));

This will make the form look like this:

<form action="http://domain.com/serach/results/something/something_else/" method="get">

The problem is that when I paginate the results it adds the page:2 or page:3 to the action so it looks like:

<form action="http://domain.com/serach/results/something/something_else/page:3" method="get">

Is there a built in function in CakePHP that lets me remove the page:3from the url that's being passed to the form action or am I going to have to create a function that looks for and removes the page:#?

Upvotes: 1

Views: 1441

Answers (1)

mark
mark

Reputation: 21743

just set your url the verbose way:

'url' => array('controller' => 'x', 'action' => 'y') + $this->request->params['pass']

Done!

Upvotes: 4

Related Questions