2012-04-04 16 views
0

我正在使用CI 2.1.0與HMVC。我將在視圖部分中實現分頁。但我得到'未定義的表數據'錯誤。它顯示分頁號碼(1,2,3,..)但不顯示記錄。未定義的表格數據

我的代碼是:

用於分頁包括庫: $這 - >負載>庫( '表');

控制器

$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(); ?> 

感謝您的支持。

+0

如果您希望有人幫助您接受您首先給出的問題的答案。 – safarov 2012-04-04 08:15:15

+0

@safarov,這不是你所想的。我做了但沒有看到任何改變。所以我試圖清楚我的目錄結構..無論如何thanx你的時間。 – npcoda 2012-04-04 08:23:57

回答

0

最後我得到解決方案。這是愚蠢的錯誤在

$配置[ '記錄'] = objectsIntoArray($這 - > eventModule-> get_record($配置[ 'per_page'],$這個 - > URI->段(3)));

它應該是的$數據代替$配置

$數據[ '記錄'] = objectsIntoArray($這 - > eventModule-> get_record($配置[ 'per_page'], $這個 - > URI->段(3)));