Codeigniter - 使用分页而不使用表格

时间:2015-03-01 18:19:39

标签: php mysql codeigniter pagination

我发现了两个与我不相似的问题,所以他们没有任何帮助。

我要做的是使用分页功能而不使用表格,因为我需要向用户显示数据而不是表格格式。换句话说,他们将以非表格格式看到名称,日期和其他内容。

我的控制器:

 $uid = $this->session->userdata('uid'); //added on sat , feb 28

    $this->load->library('pagination');
    $this->load->library('table');

    $this->table->set_heading('');



    $config['base_url'] = 'http://localhost/profile/entries';

    $config['total_rows'] = $this->db->get_where('notes', array('uid' => $uid))->num_rows();
    $this->db->where('uid', $uid);
    $this->db->order_by("time", "desc"); 
    $config['per_page'] = 20;
    $config['num_links'] = 2;

    $config['first_link'] = FALSE;
    $config['last_link'] = FALSE;


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

    $data['records'] = $this->db->get('notes', $config['per_page'], $this->uri->segment(3));
    $this->pagination->create_links();


    $this->load->view('profile/includes/header');
    $this->load->view('profile/view_all_notes', $data);

我的观点文件

<html>
    <body>
<div class="container">

        <h3 class="block-title block-title--simple"> Your <?php echo $site_title ?> Notes </h3>

    foreach ($query->result() as $row) :
     <?php

        foreach ($query->result() as $row) :

            ?>
                <div class="col-md-4">
                    <h1><?php echo $row['message']; ?></h1>
                    <h2><?php echo $row['time']; ?></h2>
                </div>
                <?php

        endforeach;
    ?>  

     <?php echo $this->pagination->create_links(); ?>



        </div>

    </body>
</html>

我尝试过这样做,但它没有显示出来。我只是不希望它以表格格式显示。感谢。

0 个答案:

没有答案