2 回答
TA贡献1963条经验 获得超6个赞
在这里,您需要使用PASS BY REFERENCEwith &concept 来解决您的问题
public function tampil_halaman_berita(&$data)//changes
{
$data['tampil_berita'] = $this->berita->getAllBerita();
$data['tampil_kategori'] = $this->berita->getAllKategori();
$data['tampil_wartawan'] = $this->berita->getAllWartawan();
}
public function index()
{
$data = array();
$data['judul'] = "Halaman Berita";
$this->tampil_halaman_berita($data);//changes
echo '<pre>';print_r($data);die;
$this->load->view('ui/Header');
$this->load->view('pages/Berita', $data);
$this->load->view('ui/Footer');
}
试试我的代码来测试,让我知道你看到了什么?
TA贡献1744条经验 获得超4个赞
-First load model in your tampil_halaman_berita() method
-get data using Model and return data
-then call first method to another method
- 2 回答
- 0 关注
- 137 浏览
添加回答
举报