public function action_index() {
$count = Model_Invoice::count();
$per_page = 20;
$config = array(
'pagination_url' => \Fuel\Core\Uri::base(false) . 'admin/invoices/index/page/',
'total_items' => $count[0]['num_entries'],
'per_page' => $per_page,
'uri_segment' => 5,
);
$pagination = Pagination::forge('invoice_pagination', $config);
$data['invoices'] = Model_Invoice::find('all', array(
'limit' => $pagination->per_page,
'offset' => $pagination->offset,
'order_by' => array(
'created_at' => 'desc',
),
));
//...
$this->template->content = View::forge('admin/invoices/index', $data)->set('pagination', $pagination, false);
}
Fuel\Core\Pagination Object
(
[config:protected] => Array
(
[current_page] =>
[offset] => 0
[per_page] => 20
[total_pages] => 0
[total_items] => 0
[num_links] => 5
[uri_segment] => 5
[show_first] =>
[show_last] =>
[pagination_url] => ...removed.../archive/admin/invoices/index/page/
[link_offset] => 0.5
[calculated_page] => 1
)
[template:protected] => Array
(
[wrapper] => <div class="pagination">
{pagination}
</div>
[first] => <span class="first">
{link}
</span>
[first-marker] => ««
[first-link] => <a href="{uri}">{page}</a>
[first-inactive] =>
[first-inactive-link] =>
[previous] => <span class="previous">
{link}
</span>
[previous-marker] => «
[previous-link] => <a href="{uri}" rel="prev">{page}</a>
[previous-inactive] => <span class="previous-inactive">
{link}
</span>
[previous-inactive-link] => <a href="#" rel="prev">{page}</a>
[regular] => <span>
{link}
</span>
[regular-link] => <a href="{uri}">{page}</a>
[active] => <span class="active">
{link}
</span>
[active-link] => <a href="#">{page}</a>
[next] => <span class="next">
{link}
</span>
[next-marker] => »
[next-link] => <a href="{uri}" rel="next">{page}</a>
[next-inactive] => <span class="next-inactive">
{link}
</span>
[next-inactive-link] => <a href="#" rel="next">{page}</a>
[last] => <span class="last">
{link}
</span>
[last-marker] => »»
[last-link] => <a href="{uri}">{page}</a>
[last-inactive] =>
[last-inactive-link] =>
)
[raw_results:protected] => Array
(
)
)
$count[0]['num_entries']
It looks like you're new here. If you want to get involved, click one of these buttons!