大家好,我有以下问题:我已经在 codeigniter 分页类的帮助下设置了分页,但我想做更多的事情:
我希望用户在输入框中输入一个值...然后$per_page
自动设置为该值:
这是我的代码:
public function index($offset = NULL, $limit = NULL)
{
$this->load->library('pagination');
$offset = $this->uri->segment(3);
$total = $this->db->count_all('posts');
$per_page = 5;
$config['base_url'] = base_url().'welcome/index';
$config['total_rows'] = $total;
$config['uri_segment'] = 3;
$config['per_page'] = $per_page;
$this->pagination->initialize($config);
$data['pagination'] = $this->pagination->create_links();
$data['posts'] = $this->Model_cats->get_pagination_field($config['per_page'], $offset);
等等...
分页工作很棒!
这是html:
<div id="pagination">
<?php echo $pagination;?>
<input type="text" id="set_pagination">
<input type="submit" id="submit_pagination">
</div>
好的,我如何提交一个数字,比如说 3,然后每页显示 3 个帖子?
任何想法? $per_page = $this->input->post
.... 某物..