开发者

Does CakePHP need a model to do pagination?

开发者 https://www.devze.com 2023-03-26 23:19 出处:网络
I have a few Controllers that work with content from Json files. I was wondering if Cakephp could help me paginate them.

I have a few Controllers that work with content from Json files. I was wondering if Cakephp could help me paginate them.

I like Cakephp's pagination much. It seems 开发者_开发技巧an extreme lot of work of writing pagination yourself and Cake's pagination does everything I'd want for my tabular data from MySQL.

This however leaves another source of content, json-files, that are not paginated on the site. What would be the best solution for this?


I would repurpose ArraySource in the community-maintained Datasources plugin so it reads from JSON files. It already has support for pagination built in [here and here], so you should only need to add in a connect() method that performs the json_decode() operation. This answer provides usage instructions.

0

精彩评论

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