Pods::total_pages PHP Method

total_pages() public method

Fetch the total number of pages, based on total rows found and the last find() limit
Since: 2.3.10
public total_pages ( null | integer $limit = null, null | integer $offset = null, null | integer $total = null ) : integer
$limit null | integer Rows per page
$offset null | integer Offset of rows
$total null | integer Total rows
return integer Number of pages
    public function total_pages($limit = null, $offset = null, $total = null)
    {
        $this->do_hook('total_pages');
        if (null === $limit) {
            $limit = $this->limit;
        }
        if (null === $offset) {
            $offset = $this->offset;
        }
        if (null === $total) {
            $total = $this->total_found();
        }
        $total_pages = ceil(($total - $offset) / $limit);
        return $total_pages;
    }