如何在codeigniter的一个控制器中使用两个视图
public function myaccount($user_id) {
$this->load->model('blog');
if(isset($_POST['post'])){
if(strlen($_FILES['inputUpProfile']['name']) > 0)
{
$pic = $this->do_upload('inputUpProfile');
if ($this->input->post('post') == ''){$type="image";} else {$type="image-with-text";}
}
else {$pic = ""; $type = "text"; }
$result = $this->blog->addPost($user_id, $type , $this->input->post('post'),$pic);
}
if(isset($_SESSION['user_id']) || !empty($_SESSION['user_id'])){
$result = $this->blog->getPost($user_id, 0 , 10);
$this->template->build("profile" , array("response"=>$result));
}
else{
$this->template->build('registration_view',$this->data);
}
$this->data['user'] = $user;
$this->data['errors'] = $this->errors;
$this->template->set_layout('myaccount');
$this->template->build('profile',$this->data);
$this->template->build('post_profile',$this->data);
}
}
这个 ic 控制器功能必须打开两个视图,但我的问题是打开一个视图。