开发者

Use query strings with Pagination Class in Codeigniter

Is it possible to append query strings to the links created by the pagination class?

Currently if you are on this page:

http://127.0.0.1/~panayi/xryses/Nicosia/browse/Homes?price_low=19&price_high=300

the links are incorrectly generated as

http://127.0.0.1/~panayi/xryses/Nicosia/browse/Homes&per_page=20
http://127.0.0.1/~panayi/xryses/Nicosia/browse/Homes&per_page=40
etc.

where it should be:

http://127.0.0.1/~panayi/xryses/Nicosia/browse/Homes?price_low=19&price_high=300&per_page=20
http://127.0.0.1/~panayi/xryses/Nicosia/browse/Homes?price_low=19&price_high=300&per_page=40
etc.

I have tried to pass

$config['base_url'] = current_url();

to the Pagination class, but that doesn't work.


Update: I gave up on this and following a post on CI forums, I have build an intermediate controller that takes the $_POST array and builds a query string

$query = 'type:apartment,house&price_low:15000&price_high:60000';

Then redirects to the Browse controller

http://127.0.0.1/~panayi/xryses/Nicosia/brow开发者_开发技巧se/type:apartment,house&price_low:15000&price_high:60000

and paginated views:

http://127.0.0.1/~panayi/xryses/Nicosia/browse/type:apartment,house&price_low:15000&price_high:60000/20
http://127.0.0.1/~panayi/xryses/Nicosia/browse/type:apartment,house&price_low:15000&price_high:60000/40
etc.


You will need to customize the Pagination library of Codeigniter to do this.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜