【发布时间】:2011-04-03 03:57:16
【问题描述】:
我已经使用 CodeIgniter 进行了分页,它将我的数据库中的结果列为标题、内容、价格和 postid。我想知道如何将它显示的内容(标题、内容、价格)显示为链接(
function index()
{
$this->load->library('pagination');
$this->load->library('table');
$this->table->set_heading('postid', 'The Title', 'The Content', 'Price');
$config['base_url'] = 'http://localhost/ganbaru/index.php/site/index';
$config['total_rows'] = $this->db->get('posts')->num_rows();
$config['per_page'] = 10;
$config['num_links'] = 20;
$config['full_tag_open'] = '<div id="pagination">';
$config['full_tag_close'] = '</div>';
$this->pagination->initialize($config);
$posts['records'] = $this->db->get('posts', $config['per_page'], $this->uri->segment(3));
$this->load->view('site_view', $posts);
}
这是查看代码
</head>
<body>
<div id="container">
<h1>Super Pagination with CodeIgniter</h1>
<?php echo $this->table->generate($records); ?>
<?php echo $this->pagination->create_links(); ?>
</div>
</body>
</html>
【问题讨论】:
标签: php codeigniter pagination hyperlink anchor