0

我将 CI 2.1.0 与 HMVC 一起使用。我将在视图部分实现分页。但我收到“未定义的表数据”错误。它显示页码 (1,2,3,..) 但不显示记录。

我的代码是:

包含分页库: $this->load->library('table');

控制器

$data['title'] = "Test Events";
$this->load->library('pagination');

$config['base_url'] = 'http://localhost/myproject/index.php/events/test/';
$config['total_rows'] = $this->eventModule->countRow();
$config['per_page'] = '3';

$this->pagination->initialize($config);
$config['records'] = objectsIntoArray($this->eventModule->get_record($config['per_page'], $this->uri->segment(3)));

$data['main_content'] = 'test';       
$this->load->view('event/template', $data); 

看法

<?php echo $this->table->generate('records'); ?>
<?php echo $this->pagination->create_links(); ?>  

谢谢你的支持。

4

1 回答 1

0

最后我得到了解决方案。这是愚蠢的错误

$config['records'] = objectsIntoArray($this->eventModule->get_record($config['per_page'], $this->uri->segment(3)));

它应该是$data而不是$config

$data['records'] = objectsIntoArray($this->eventModule->get_record($config['per_page'], $this->uri->segment(3)));

于 2012-04-05T05:10:55.983 回答