查看表中的数据生成codeigniter

时间:2013-02-15 23:08:11

标签: php codeigniter

我在使用codeigniter时遇到了困难,正如我所说的那样。我想在表视图中包含但是表的问题。

这个代码本身

$set_tabelx = array ('table_open' => "<table cellspacing='0' cellpadding='0' id='area_admin' border='1'>");
$this->table->set_template($set_tabelx);
if(isset($halaman)){
    $hal = $this->load->view('admin/'.$halaman);
}
$atas = "<div id='judul_utama'>".$judul_atas."<div class='kanan'><img src='".base_url()."images/icon_system/37.png' /> Hai, ".$this->session->userdata('username')."</div></div>";
$menu = $this->load->file("application/views/admin/menu.php", true);
$isi = "<div id='jp-container' class='jp-container'><div id='isi_admin'>".$hal."</div></div><br />";
$bawah = $this->load->file("application/views/admin/footer.php", true);

$this->table->add_row(array('data' => $atas, 'colspan' => 2));
$this->table->add_row(
    array('data' => $menu, 'valign' => "top", 'id' => "jp-menu", 'class' => "jp-menu bg_menu"),
    array( 'valign' => "top", 'class' => "bg_isi", 'data' => "<div id='jp-container' class='jp-container'><div id='isi_admin'>".$hal."</div></div><br />"));
$this->table->add_row(array('data' => $bawah, 'colspan' => 2));
echo $this->table->generate();

这个问题

if(isset($halaman)){
    $hal = $this->load->view('admin/'.$halaman);
}
$this->table->add_row(
    array('data' => $menu, 'valign' => "top", 'id' => "jp-menu", 'class' => "jp-menu bg_menu"),
    array( 'valign' => "top", 'class' => "bg_isi", 'data' => "<div id='jp-container' class='jp-container'><div id='isi_admin'>".$hal."</div></div><br />"));

任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分:1)

通过第三个参数将视图作为字符串返回:

$hal = $this->load->view('admin/'.$halaman, NULL, TRUE);