PKPTemplateManager::smartyPageInfo PHP Method

smartyPageInfo() public method

Usage: {page_info from=$myIterator}
public smartyPageInfo ( $params, $smarty )
    function smartyPageInfo($params, $smarty)
    {
        $iterator = $params['iterator'];
        if (isset($params['itemsPerPage'])) {
            $itemsPerPage = $params['itemsPerPage'];
        } else {
            $itemsPerPage = $smarty->get_template_vars('itemsPerPage');
            if (!is_numeric($itemsPerPage)) {
                $itemsPerPage = 25;
            }
        }
        $page = $iterator->getPage();
        $pageCount = $iterator->getPageCount();
        $itemTotal = $iterator->getCount();
        if ($pageCount < 1) {
            return '';
        }
        $from = ($page - 1) * $itemsPerPage + 1;
        $to = min($itemTotal, $page * $itemsPerPage);
        return __('navigation.items', array('from' => $to === 0 ? 0 : $from, 'to' => $to, 'total' => $itemTotal));
    }