CI 묻고 답하기

제목 1.7버젼에서 이상없는데 2.1버젼에서 오류발생 합니다.
글쓴이 꾸숑 작성시각 2013/01/23 04:56:10
댓글 : 3 추천 : 0 스크랩 : 0 조회수 : 14727   RSS

아래 소스는 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버젼에서 오류 발생했습니다. 매뉴얼을 좀 찾아보긴 했지만 잘 보이지 않아 여쭈어 봅니다.





 

 다음글 설정 다 하고 사이트 들어갔는데요 index.php 문... (8)
 이전글 2.1버젼에는 'scaffolding_trigger' ... (2)

댓글

변종원(웅파) / 2013/01/23 07:55:24 / 추천 0
매뉴얼에서 anchor 검색하면 답이 있습니다. 그리고 아직 1.7대 버전과 2.x대 버전 차이점을 제대로 모르시는 것 같습니다. 소스에서 생성자가 왜 그렇게 되어 있을까요? 여기에 답이 있습니다.
꾸숑 / 2013/01/25 18:56:00 / 추천 0
웅파님

답변 감사합니다.

몇일 인터넷이 안되는곳에 있어서 감사 인사 못드렸네요...
꾸숑 / 2013/01/27 14:04:21 / 추천 0

아래 소스처럼  하니까 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('../');
 } 
 
  }
?>