如果我为每个页面设置模板,那么如何进行数据库调用并将其作为参数发送到我的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