diff --git a/smarty/function.draw_pagination.php b/smarty/function.draw_pagination.php new file mode 100755 index 0000000..e69de29 diff --git a/smarty/function.pagination.php b/smarty/function.pagination.php new file mode 100755 index 0000000..12a95a4 --- /dev/null +++ b/smarty/function.pagination.php @@ -0,0 +1,53 @@ +trigger_error('assign: missing \'current\' parameter'); + } + else if (empty($params['total'])) { + $smarty->trigger_error('assign: missing \'total\' parameter'); + } + else if (empty($params['section'])) { + $smarty->trigger_error('assign: missing \'section\' parameter'); + } + else { + $current =& $params['current']; + $total =& $params['total']; + $section =& $params['section']; + + $pagination = null; + + // « = double + // &lsaquo = single + + $first = '« First'; + $last = 'Last »'; + + $prev = '« Previous'; + $next = 'Next »'; + + /* + $pagination .= ' '; + $pagination .= $current != $total ? '' . $first . '' : $first; + $pagination .= ''; + */ + + $pagination .= $current != 1 ? '' . $prev . '' : '' . $prev . ''; + + for ($i = 1; $i <= $total; $i++) { + $pagination .= $i != $current ? '' . $i . '' : '' . $i . ''; + } + + $pagination .= $current != $total ? '' . $next . '' : '' . $next . ''; + + /* + $pagination .= ' '; + $pagination .= $current != 1 ? '' . $last . '' : $last; + $pagination .= ' '; + */ + + return '