CI 묻고 답하기

제목 views 폴더 변경하기..
글쓴이 완장6호 작성시각 2013/01/31 18:07:27
댓글 : 6 추천 : 0 스크랩 : 0 조회수 : 18414   RSS
 CI 폴더를   www 폴더와 동일 위치에 놓고..

home/user/CI
home/user/www

www 폴더를 views 폴더로 잡고 싶습니다.

CI/index.php 파일을 www 에 카피후  application 이랑 system 폴더는 수정했는데..  views 수정하는게 없네요..

Loader.php 파일의  __construct 부분에서
$this->_ci_view_paths = array('/home/user/www/' => TRUE);

로 수정했는데..  호출한 뷰 페이지가 보이긴 하는데...
뷰페이지에 <? 태그가 들어가면 그기서 오류가 나는듯 하네요..

매뉴얼 뒤져봐도 views 폴더 수정하는건 못찾겠네요..









 다음글 sess_time_to_update 이 부분에 관한 질... (1)
 이전글 db 연동 문제 질문드립니다. (14)

댓글

변종원(웅파) / 2013/01/31 18:17:29 / 추천 0
 2.1.x대 Loader.php 입니다.
function __construct()
 {
  $this->_ci_view_path = APPPATH.'views/';
  $this->_ci_ob_level  = ob_get_level();
  $this->_ci_library_paths = array(APPPATH, BASEPATH);
  $this->_ci_helper_paths = array(APPPATH, BASEPATH);
  $this->_ci_model_paths = array(APPPATH);

  log_message('debug', "Loader Class Initialized");
 }
완장6호 / 2013/01/31 18:24:39 / 추천 0
버전 2.1.3  이고요..
system/core/Loader.php  가..

public function __construct()
{
$this->_ci_ob_level  = ob_get_level();
$this->_ci_library_paths = array(APPPATH, BASEPATH);
$this->_ci_helper_paths = array(APPPATH, BASEPATH);
$this->_ci_model_paths = array(APPPATH);
$this->_ci_view_paths = array('/home/user/www/' => TRUE);
log_message('debug', "Loader Class Initialized");
}

요렇게 되어 있는 상태입니다.
변종원(웅파) / 2013/01/31 22:01:15 / 추천 0
2.1.3에서 배열로 바뀌었네요.

index.php 열어서 APPPATH가 어떻게 되어 있는지 보시고 패스 수정하세요.
criuce / 2013/02/01 11:02:15 / 추천 0
저희회사에서 사용하고 있는 코드입니다.

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 
class Cimple_X_Loader extends CI_Loader {
    
    function __construct()
    {
        parent::__construct();
        log_message('DEBUG', 'load Cimple_X_loader');
    }
    
    function add_view_path($path, $view_cascade=TRUE)
    {        
        $this->_ci_view_paths = array($path => $view_cascade) + $this->_ci_view_paths;
        return TRUE;
    }
}

완장6호 / 2013/02/01 13:18:59 / 추천 0
감사합니다.
위 내용을 application/library/Cimple_X_Loader.php  로 만들어서


application/config/autoload.php 에서
$autoload['libraries'] = array('Cimple_X_Loader''); 로 해줌 되나요?
criuce / 2013/02/01 13:40:08 / 추천 0
아 이건 코어를 확장한거구요. 편리하게 쓰시려면 add_view_path만 Loader 코어 안에 넣어주세요.