| 제목 | 1원팁. 저의 Template_ 이용방법입니다. | ||
|---|---|---|---|
| 글쓴이 | DJ구스 | 작성시각 | 2011/10/31 02:47:18 | 
|  | |||
| 제가 쓰는 방식인데요.. 기본적으로 include  할 파일들은 Construct에 호출을 해서 모든 페이지에서 동일하게 보여주고 템플릿 변수로 사용 할 것만 해당 콘트롤러 부분에서 처리해서 보여주는 형태입니다. 매번 각 호출 할때마다 똑같이 복사해서 넣어줘야 하는 질문을 받았는데 사실 그렇게 까지는 할 필요는 없구요 저런 방식으로 처리 해주셔도 됩니다. 
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Controller of user. 
 * Created by namgoos.
 * Date time: 11. 9. 23. 오전 6:48
 */
class User extends CI_Controller
{
 function __construct()
 {
  parent::__construct();
  $this->output->enable_profiler(TRUE);
  $this->load->library('Firephp');
  // checking logined
  $this->zuna_auth->check_login(TRUE);  
  $this->template->define(array(
          'head'    => 'bo/inc.head.tpl',
          'header'   => 'bo/inc.header.tpl',          
           'footer'   => 'bo/inc.footer.tpl' 
        ));
   
 }
 function lists()
 {
  $this->template->assign(array(
          'admin_info' => $this->session,
          'user_list' => $arrResult['query']->result_array(),
          'user_count' => $arrUserCount,
          'pagination' => $this->pagination->create_links()
        ));
  $this->template->define('user', 'bo/user.tpl');
  $this->template->print_('user');
 }
}
/* End of file Dash_board.php */
/* Location: ./application/controllers/User.php */ | |||
| 다음글 | Form_validation 라이브러리 less_tha... (2) | ||
| 이전글 | MYSQL 자동으로 시간 설정 (5) | ||
| 
                                한대승(불의회상)
                                /
                                2011/10/31 09:00:32 /
                                추천
                                0
                             
                                namGoos// 좋은 정보 감사 합니다. ^^ | 
| 
                                milosz
                                /
                                2011/10/31 09:08:00 /
                                추천
                                0
                             
                                 1원..이라면서요 ;ㅅ; 좋은 팁 보고 갑니다!!!
                             |