routing - Zend Framework paginator force $_GET params usage -


Is it possible to use paginator with $ _GET parameter?

For example, I have a route like this:

  $ router-> AddRoute ('ajax_gallery', new Routes_Categories ('/: lang /: category / age /: dep /: cat /: cities', array ("page" = & gt; 1, "dep" => 0, Cat "= & gt; 0," towns "= 0, 0), array (" dep "=> [" 0-9] + "," cat "= & gt;" [0- 9] + ")));  

And I am requesting through AJAX in such a way:

But with the results that are returned with results? Dep = 9 & amp; Cat = 27 & amp; Towns = 1

How can a Pageinator be implemented to use the $$ _GET parameter within the Pagination link generation?

Therefore the returned links were:

 http: // local host / n / gallery / 2? DP = 9 and cat = 27 and towns = 1 http: // localhost / en / gallery / 3? Dep = 9 and cat = 27 and cities = 1 http: // localhost / en / gallery / 4? Dep = 9 and cat = 27 and towns = 1 

etc ...

or even

 http: // localhost / en / Gallery / 2/9/27/1 Http: // localhost / en / gallery / 3/9/27/1 http: // localhost / en / gallery / 4/9/27/1 

As they are defined within the route etc. .

Thanks

The visible URL assistant will always output the parameter as part of URL (separated by Forward Slash) and for my knowledge, GET parameter does not support format.

I do not know what the Routes_Categories class does, but working with the default ZF route: try

$ route = new Zend_Controller_Router_Route ('/: lang /: Category /: age /: dep /: cat /: Cities / * ', array ("dep" => 0, "cat" => 0, "towns" => 1), array ("Dep" = & gt; "[0-9] +", "cat" => [[0-9] + ")); $ Router- & gt; Add-root ('ajax_gallery', $ route);

* Supports any additional named params after your route. The above is assumed that Lang, category and age are required, and deputy, cat and towns are optional. Keep in mind that if you want to set a cat, you have to set up Diff otherwise the path will be confused which is what the variable is.

Use the page param through the following in your controller, which sets the default of 1

$ page = $ this- & gt; _getParam ('Page', 1); Access the URL via the URL:

If you want the page to be absolute, use the named parameter:

This To work the route, you need to update your Pageinator visual controls to use the right path in your endorsement. See:

Search for the code where the URL is output and add the path name to the URL view assistant. Then change the code like this:

  ; = this- & gt; previous)); ? & Gt; With  

:

  ; = this- & gt; previous), 'Ajax_gallery'); ? & Gt;  

Comments