This commit is contained in:
36
app/Libraries/Common.php
Normal file
36
app/Libraries/Common.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
namespace App\Libraries;
|
||||
|
||||
class Common
|
||||
{
|
||||
|
||||
public function make_pagenation($base_uri, $parameters, $total_rows = 0, $cur_page = 1, $per_page = 10, $num_links = 10)
|
||||
{
|
||||
if (!is_numeric($cur_page) || empty($cur_page))
|
||||
$cur_page = 1;
|
||||
if (!is_numeric($per_page) || empty($per_page))
|
||||
$per_page = 10;
|
||||
|
||||
$parameters['page'] = '[page]'; // 필수 --> 이게 모든 페이지의 파라메터를 동적으로 할당하는 것이다.
|
||||
$base_uri .= make_query_string($parameters);
|
||||
|
||||
|
||||
if (empty($num_links))
|
||||
$num_links = 10;
|
||||
|
||||
$config['base_url'] = $base_uri;
|
||||
$config['total_rows'] = $total_rows;
|
||||
$config['cur_page'] = $cur_page;
|
||||
$config['per_page'] = $per_page;
|
||||
$config['num_links'] = $num_links; // 페이지의 갯수가 일정하게 보이도록....
|
||||
$config['full_tag_open'] = '<div class="pagination">';
|
||||
$config['full_tag_close'] = '</div>';
|
||||
|
||||
$CI =& get_instance();
|
||||
$CI->load->library('pagination');
|
||||
$CI->pagination->initialize($config);
|
||||
$pagination = $CI->pagination->create_links();
|
||||
return $pagination;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user