아래 소스는 2.1버젼 controllers 의 blog.php 입니다.
<?
class Blog extends CI_Controller{
function __construct(){
parent::__construct();
}
function Blog(){
$this->load->helper('url');
$this->load->helper('form');
}
function index(){
$data['title']='리스트';
$data['query']=$this->db->get('blog');
$this->load->view('blog_view',$data);
}
function comment(){
$data['title']='글쓰기';
$this->load->view('comment_view',$data);
}
function comment_insert(){
$this->db->insert('blog',$_POST);
redirect('../');
}
}
?>
아래 소스는 views 의 blog_view.php의 일부분 입니다.
23라인 <?=anchor('blog/comment/','답글');?>
오류 메세지
Fatal error: Call to undefined function anchor() in C:\APM_Setup\htdocs\ci\application\views\blog_view.php on line 23
1.7버젼에서는 이상없이 동작했는데.. 2.1버젼에서 오류 발생했습니다. 매뉴얼을 좀 찾아보긴 했지만 잘 보이지 않아 여쭈어 봅니다.
아래 소스처럼 하니까 helper 정상 작동 되는군요..
이제 게시판 만들기 일단 출발 합니다.^^
<?
class Blog extends CI_Controller{
function Blog(){
parent::__construct();
$this->load->helper('url');
$this->load->helper('form');
}
function index(){
$data['title']='리스트';
$data['query']=$this->db->get('blog');
$this->load->view('blog_view',$data);
}
function comment(){
$data['title']='글쓰기';
$this->load->view('comment_view',$data);
}
function comment_insert(){
$this->db->insert('blog',$_POST);
redirect('../');
}
}
?>