创建数据表,将数据传递到视图代码点火器


creating data tables passing data to the view code igniter

我看到要使数据库表出现,类似于

$dataToBePassed = //SOME QUERY

$this->load->view('viewpage', $dataToBePassed);习惯于

但是我该如何使用模板来做到这一点呢?

就像我有这个将视图加载到我的模板中一样

  $data['content_view'] = 'viewpage';
  $this->templates->admin_template($data);

然后将传递给

//templates html codes
       <?php $this->load->view($content_view); ?>
//templates html codes

我该如何制作

//templates html codes
       <?php $this->load->view($content_view); ?>
//templates html codes

喜欢这个

//templates html codes
   <?php $this->load->view($content_view, $data); ?>
//templates html codes

控制器

$data['view'] = 'your_view';
$data['content'] = $this->Model->fn_model();
$this->load->view('themplate',$data)

视图

<?php print_r($content); ?> // $content form $data['content']