CodeIgniter模板

时间:2015-11-09 21:06:38

标签: php mysql database codeigniter codeigniter-2

如果我为每个页面设置模板,那么如何进行数据库调用并将其作为参数发送到我的topNav页面?

$template['user']['template'] = 'user/u.template.php';
$template['user']['regions'] = array(
   'title'      => array('content' => ""),
   'projectName'=> array('content' => ''),
   'topNav'     => array('content' => $this->CI->load->view('nav/topnav.php', NULL, TRUE)),
   'subNav'     => array('content' => $this->CI->load->view('nav/subnav.php', NULL, TRUE)),
//'footer'     => array('content' => $this->CI->load->view('user/parts/footer.v.php', NULL, TRUE)),
   'content'    => array('content' => "content")

);

我试着这样做:

$announcements = $this->db->get('announcements');但是我明白了,

  

消息:未定义属性:MY_Loader :: $ db

     

文件名:config / template.php

0 个答案:

没有答案