Php 如何在CodeIgniter中将分页集成到搜索中?

Php 如何在CodeIgniter中将分页集成到搜索中?,php,codeigniter,search,pagination,Php,Codeigniter,Search,Pagination,我使用codeigniter进行了简单的搜索,没有ajax之类的东西,我想集成分页类,我读了一些示例,他们使用了一个库,如$this->table->generate($results)并且我需要在每个结果中使用一个按钮来编辑该条目。我已经这样做了,但是现在用这种方式显示分页我有一个大问题,请问,有人能帮我解决这个问题吗?我只是需要一个线索或者什么东西在CI中找到 我把模型、控制器和视图放在这里以防万一 控制器 public function searchdescription() {

我使用codeigniter进行了简单的搜索,没有ajax之类的东西,我想集成分页类,我读了一些示例,他们使用了一个库,如
$this->table->generate($results)并且我需要在每个结果中使用一个按钮来编辑该条目。我已经这样做了,但是现在用这种方式显示分页我有一个大问题,请问,有人能帮我解决这个问题吗?我只是需要一个线索或者什么东西在CI中找到

我把模型、控制器和视图放在这里以防万一

控制器

public function searchdescription()
     {
     //$keyword = $this->input->post('keyword');
     $keyword = $_POST['keyword']; 
     $this->load->model('searchdesc/searchdesc_model');
     $data['retorno'] = $this->searchdesc_model->querydb($keyword);
     $this->load->view('searchdesc/searchresults_view', $data);
}
模型

function querydb($data,$num, $offset)
    {

    $queryresult = $this->db->query("select * from data where deleteflag=0  and title like     '%$data%' or text like '%$data%' LIMIT $num, $offset ");
    return $queryresult->result_array();
    }
看法

下面是一个示例(不使用模型)

当然,您将根据需要进行修改

以下是一个示例(不使用模型)

当然,您将根据需要进行修改

请阅读此处:请阅读此处:
foreach ($retorno as $val)
{
echo $val['id'];
echo $val['title'];
echo $val['text'];
...here are some forms autocreated in each row that i need to keep making it
}
public function big()
{
    $this->load->library('pagination');
    $this->load->library('table');

    $config['base_url'] = base_url().'/site/big/';
    $where = "bot = '2' OR bot = '0'";
    $this->db->where($where);
    $config['total_rows'] = $this->db->count_all_results('visitors');
    $config['per_page'] = 15;
    //$config['num_links'] = 20;
    $config['full_tag_open'] = '<div id="pagination">';
    $config['full_tag_close'] = '</div>';

    $this->pagination->initialize($config);     

    $where = "bot = '2' OR bot = '0'";
    $this->db->where($where);
    $this->db->select('id, ip, date, page, host, agent, spammer, country, total, refer');
    $this->db->order_by("date", "DESC");
    $data['records'] = $this->db->get('visitors', $config['per_page'], $this->uri->segment(3));

    $this->table->set_heading('Id', 'IP', 'Date', 'Page', 'Host', 'Agent', 'Spam', 'Country', 'Total', 'Referer');

   $this->db->select_sum('total', 'trips');
   $query = $this->db->get('visitors');
   $data['trips'] = $query->result();

    $this->load->view('site_view', $data);      
}
<?php echo $this->table->generate($records); ?>
<?php echo $this->pagination->create_links(); ?>
foreach($records as $row){
$row->title = ucwords($row->title);

$this->table->add_row(
$row->date,
anchor("main/blog_view/$row->id", $row->title),
$row->status,    
anchor("main/delete/$row->id", $row->id, array('onClick' => "return confirm('Are you sure you want to delete?')")),
anchor("main/fill_form/$row->id", $row->id)
);
}
$table = $this->table->generate();
echo $table;