This function retrieve value like findAll function but it create a pagination based on a limit
App::InformationSet(NAME)->Paging(CONDITION,LIMIT,LINK);
•In CONDITION we can pass condition of WHERE clause as parameter of the function.
•LIMIT is the number of entry per page. By default it set value from admin setting (Admin > Preferences >Site Setting)
•LINK : We can pass a link to redirect the page in a particular link. If by default system set current URL
For example:
$data = App::InformationSet('blogpost')->paging("1 ORDER BY id DESC",1);
// Return value
/*Array
(
[data] => Array
(
[0] => Array
(
[id] => 2
[adminref] => 1
[entrydate] => 2012-12-12 22:23:41
[lastmodified] => 2012-12-13 23:59:32
[title] => Work with Page and UI Hooks
[category] => 1
[description] => Page manager is one of the best tool to organize content
[status] => Public
)
)
[paging] => <a href="?&page=2" class="page_next" title="Next">Next</a>
[link] => Showing Results 1-1 of 2
[total] => 2
[page] => 1
[paging_str] => <div class="pagination pagination-left">
<div class="results">
<span>Showing Results 1-1 of 2</span>
</div>
<ul class="pager">
<li class="disabled">Previous</li>
<li class="current">1</li><li><a href="?&page=2">2</a> </li>
<li><a href="?&page=2" class="page_next" title="Next">Next</a></li>
</ul>
</div>
)
*/
A common example to pass GET parameter:
$List = App::InformationSet('blogpost')->paging("1 ORDER BY ID ASC",2,'?x=y');
In the above example pagination will generate like bellow
[paging] => <a href="?x=y&page=2" class="page_next" title="Next">Next</a>