public static function create_links([b]$prev = null, $next = null[/b]) { if (static::$total_pages == 1) { return ''; } [b]if(!$prev) { $prev = '« Previous'; } if(!$next) { $next = 'Next »'; }[/b] $pagination = ''; // Let's get the starting page number, this is determined using num_links $start = ((static::$current_page - static::$num_links) > 0) ? static::$current_page - (static::$num_links - 1) : 1; // Let's get the ending page number $end = ((static::$current_page + static::$num_links) < static::$total_pages) ? static::$current_page + static::$num_links : static::$total_pages; $pagination .= ' '.static::prev_link([b]$prev[/b]).' '; for($i = $start; $i <= $end; $i++) { if (static::$current_page == $i) { $pagination .= '<b>'.$i.'</b>'; } else { $url = ($i == 1) ? '' : '/'.$i; $pagination .= \Html::anchor(rtrim(static::$pagination_url, '/') . $url, $i); } } $pagination .= ' '.static::next_link([b]$next[/b]); return $pagination; }
It looks like you're new here. If you want to get involved, click one of these buttons!