<?php /** * Pagination Class * * Created on 2011. 11. 16. * @author 불의회상 <hoksi2k@hanmail.net> * @package library * @subpackage controllers * @version 1.0 */ class Pagination_lib extends CI_Controller { function __construct() { parent::__construct(); } function index($mode = 'default') { $this->load->library('pagination'); $config['total_rows'] = 200; $config['per_page'] = 20; $config['uri_segment'] = 4; if($mode == 'default') { $config['base_url'] = site_url('pagination_lib/index/default/'); } elseif($mode == 'query_string') { $config['base_url'] = site_url('pagination_lib/index/query_string/?'); $config['page_query_string'] = TRUE; } elseif($mode == 'use_page_numbers') { $config['base_url'] = site_url('pagination_lib/index/use_page_numbers/'); $config['use_page_numbers'] = TRUE; } elseif($mode == 'full_tag') { $config['base_url'] = site_url('pagination_lib/index/full_tag/'); $config['full_tag_open'] = '<p style="font-size:15px">'; $config['full_tag_close'] = '</p>'; } elseif($mode == 'first_last') { $config['base_url'] = site_url('pagination_lib/index/first_last/'); $config['first_link'] = '처음'; $config['first_tag_open'] = '<span style="color:red">'; $config['first_tag_close'] = '</span>'; $config['last_link'] = '마지막'; $config['last_tag_open'] = '<span style="color:red">'; $config['last_tag_close'] = '</span>'; } elseif($mode == 'next_prev') { $config['base_url'] = site_url('pagination_lib/index/next_prev/'); $config['prev_link'] = '이전'; $config['prev_tag_open'] = '<span>'; $config['prev_tag_close'] = '</span>'; $config['next_link'] = '다음'; $config['next_tag_open'] = ' <span>'; $config['next_tag_close'] = '</span>'; } elseif($mode == 'current') { $config['base_url'] = site_url('pagination_lib/index/current/'); $config['cur_tag_open'] = ' <b>'; $config['cur_tag_close'] = '</b>'; } elseif($mode == 'number') { $config['base_url'] = site_url('pagination_lib/index/number/'); $config['num_tag_open'] = ' <b>'; $config['num_tag_close'] = '</b>'; } elseif($mode == 'custom') { $config['base_url'] = site_url('pagination_lib/index/custom/'); $config['use_page_numbers'] = TRUE; $config['full_tag_open'] = '<div class="pagination"><ul>'; $config['full_tag_close'] = '</ul></div>'; $config['first_link'] = '<<'; $config['first_tag_open'] = '<li>'; $config['first_tag_close'] = '</li>'; $config['last_link'] = '>>'; $config['last_tag_open'] = '<li>'; $config['last_tag_close'] = '</li>'; $config['prev_link'] = '<'; $config['prev_tag_open'] = '<li>'; $config['prev_tag_close'] = '</li>'; $config['next_link'] = '>'; $config['next_tag_open'] = '<li>'; $config['next_tag_close'] = '</li>'; $config['cur_tag_open'] = '<li class="active"><a href="#">'; $config['cur_tag_close'] = '</a></li>'; $config['num_tag_open'] = '<li>'; $config['num_tag_close'] = '</li>'; } $this->pagination->initialize($config); $data['pagination'] = $this->pagination->create_links(); $this->load->view('pagination_lib_sample', $data); } }
<?php $this->load->view('inc/header')?> <table class="tablesorter" border="0" cellpadding="0" cellspacing="1"> <thead> <tr> <th width="20%">구분</th> <th>Sample url</th> </tr> </thead> <tr> <td>default</td> <td><a href="<?=site_url('pagination_lib')?>"><?=site_url('pagination_lib')?></a></td> </tr> <tr> <td>$config['page_query_string'] = TRUE</td> <td><a href="<?=site_url('pagination_lib/index/query_string')?>"><?=site_url('pagination_lib/index/query_string')?></a></td> </tr> <tr> <td>$config['use_page_numbers'] = TRUE</td> <td><a href="<?=site_url('pagination_lib/index/use_page_numbers')?>"><?=site_url('pagination_lib/index/use_page_numbers')?></a></td> </tr> <tr> <td>full_tag</td> <td><a href="<?=site_url('pagination_lib/index/full_tag')?>"><?=site_url('pagination_lib/index/full_tag')?></a></td> </tr> <tr> <td>First, Last Link Customizing</td> <td><a href="<?=site_url('pagination_lib/index/first_last')?>"><?=site_url('pagination_lib/index/first_last')?></a></td> </tr> <tr> <td>Next, Prev Link Customizing</td> <td><a href="<?=site_url('pagination_lib/index/next_prev')?>"><?=site_url('pagination_lib/index/next_prev')?></a></td> </tr> <tr> <td>Current Link Customizing</td> <td><a href="<?=site_url('pagination_lib/index/current')?>"><?=site_url('pagination_lib/index/current')?></a></td> </tr> <tr> <td>Number Link Customizing</td> <td><a href="<?=site_url('pagination_lib/index/number')?>"><?=site_url('pagination_lib/index/number')?></a></td> </tr> <tr> <td>사용자 정의(종합)</td> <td><a href="<?=site_url('pagination_lib/index/custom')?>"><?=site_url('pagination_lib/index/custom')?></a></td> </tr> <thead> <tr> <th style="text-align:center" colspan="2">Pagination Example</th> </tr> </thead> <tr> <td colspan="2"><?php echo $pagination?></td> </tr> <thead> <tr> <th style="text-align:center" colspan="2">Pagination Html</th> </tr> </thead> <tr> <td colspan="2"><xmp class="well"><?=str_replace(array('<a', '>', '</'), array("\n<a", ">\n", "\n</"), $pagination)?></xmp></td> </tr> </table> <?php $this->load->view('inc/footer')?>
© Copyright by hoksi(Page rendered in 0.0116 seconds)