Introduction Last updated: 04/10/2020
PHPtricks-ORM allows you to paginate data in easy.
its can quickly generate pages links based on the current page,
and the generated HTML is compatible with the Bootstrap & Zurp Foundation CSS Frameworks.
and set you data in table.
all that in 3 lines of code.
$users->where('is_active', 1)->paginate(10);
echo $users->dataView();
echo $users->link();
Get Started
Configuration :
to get started working with paginate you must be know that.
in PHPtricks/Orm/Config/database_config.php
find :
"pagination"
key.
"pagination" => [
"no_data_found_message" => "Oops, No Data Found to show ..",
"records_per_page" => 10,
"link_query_key" => "page",
],
no_data_found_message | Message will returned if no data returned from your query. |
records_per_page | Records you want to retrieve. |
link_query_key |
uri query key name https://your-website.com?page=3 .
|
Paginate Data :
$postsModel = new PostModel();
$posts = $postsModel->paginate(20);
using paginate()
without sending records count
that make PHPtricks-ORM use the count you set in config.
$postsModel = new PostModel();
$posts = $postsModel->paginate();
View Data in Table :
$postsModel = new PostModel();
$posts = $postsModel->paginate();
echo $posts->dataView();
First Column | second Column | Third Column |
---|---|---|
Data... | Foo | Barr |
Generate Links :
$postsModel = new PostModel();
$posts = $postsModel->paginate();
echo $posts->dataView();
echo $posts->link();