| 제목 | views 디렉토리를 루트로 빼려다 실패했습니다; | ||
|---|---|---|---|
| 글쓴이 | 터프키드 | 작성시각 | 2009/08/27 11:43:15 |
|
|
|||
|
구글링해보니 system/libraries 안에 있는 Loader.php 에서 $this->_ci_view_path = 'templates/';이렇게 바꿔주라고 해서 바꿨는데 안되더라구요 CLE 위젯을 사용해서 그런가요 (application/libraries/MY_Loader.php 가 있음) 시스템과 같은 경로에 두려고 하는데 접근을 못하네요 MY_Loader.php 의 코드는
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Loader extends CI_Loader{
function __construct()
{
parent::CI_Loader();
}
// --------------------------------------------------------------------
/**
* Class Loader
*
* This function lets users load and instantiate classes.
* It is designed to be called from a user's app controllers.
*
* @access public
* @param string the name of the class
* @param mixed the optional parameters
* @param string an optional object name
* @return void
*/
function controller($controller = '', $params = NULL, $object_name = NULL)
{
if ($controller == '')
{
return FALSE;
}
if ( ! is_null($params) AND ! is_array($params))
{
$params = NULL;
}
if (is_array($controller))
{
foreach ($controller as $class)
{
$this->_ci_load_controller($class, $params, $object_name);
}
}
else
{
$this->_ci_load_controller($controller, $params, $object_name);
}
}
function _ci_load_controller($class, $params = NULL, $object_name = NULL)
{
// Get the class name, and while we're at it trim any slashes.
// The directory path can be included as part of the class name,
// but we don't want a leading slash
$class = str_replace(EXT, '', trim($class, '/'));
// Was the path included with the class name?
// We look for a slash to determine this
$subdir = '';
if (strpos($class, '/') !== FALSE)
{
// explode the path so we can separate the filename from the path
$x = explode('/', $class);
// Reset the $class variable now that we know the actual filename
$class = end($x);
// Kill the filename from the array
unset($x[count($x)-1]);
// Glue the path back together, sans filename
$subdir = implode($x, '/').'/';
}
// We'll test for both lowercase and capitalized versions of the file name
foreach (array(ucfirst($class), strtolower($class)) as $class)
{
$subclass = APPPATH.'controllers/'.$subdir.config_item('subclass_prefix').$class.EXT;
// Is this a class extension request?
if (file_exists($subclass))
{
$baseclass = BASEPATH.'controllers/'.ucfirst($class).EXT;
if ( ! file_exists($baseclass))
{
log_message('error', "Unable to load the requested class: ".$class);
show_error("Unable to load the requested class: ".$class);
}
// Safety: Was the class already loaded by a previous call?
if (in_array($subclass, $this->_ci_loaded_files))
{
// Before we deem this to be a duplicate request, let's see
// if a custom object name is being supplied. If so, we'll
// return a new instance of the object
if ( ! is_null($object_name))
{
$CI =& get_instance();
if ( ! isset($CI->$object_name))
{
return $this->_ci_init_class($class, config_item('subclass_prefix'), $params, $object_name);
}
}
$is_duplicate = TRUE;
log_message('debug', $class." class already loaded. Second attempt ignored.");
return;
}
include_once($baseclass);
include_once($subclass);
$this->_ci_loaded_files[] = $subclass;
return $this->_ci_init_class($class, config_item('subclass_prefix'), $params, $object_name);
}
// Lets search for the requested library file and load it.
$is_duplicate = FALSE;
for ($i = 1; $i < 3; $i++)
{
$path = ($i % 2) ? APPPATH : BASEPATH;
$filepath = $path.'controllers/'.$subdir.$class.EXT;
// Does the file exist? No? Bummer...
if ( ! file_exists($filepath))
{
continue;
}
// Safety: Was the class already loaded by a previous call?
if (in_array($filepath, $this->_ci_loaded_files))
{
// Before we deem this to be a duplicate request, let's see
// if a custom object name is being supplied. If so, we'll
// return a new instance of the object
if ( ! is_null($object_name))
{
$CI =& get_instance();
if ( ! isset($CI->$object_name))
{
return $this->_ci_init_class($class, '', $params, $object_name);
}
}
$is_duplicate = TRUE;
log_message('debug', $class." class already loaded. Second attempt ignored.");
return;
}
include_once($filepath);
$this->_ci_loaded_files[] = $filepath;
return $this->_ci_init_class($class, '', $params, $object_name);
}
} // END FOREACH
// One last attempt. Maybe the library is in a subdirectory, but it wasn't specified?
if ($subdir == '')
{
$path = strtolower($class).'/'.$class;
return $this->_ci_load_controller($path, $params);
}
// If we got this far we were unable to find the requested class.
// We do not issue errors if the load call failed due to a duplicate request
if ($is_duplicate == FALSE)
{
log_message('error', "Unable to load the requested class: ".$class);
show_error("Unable to load the requested class: ".$class);
}
}
}
/* End of file MY_Loader.php */
/* Location: ./system/application/libraries/Loader.php */
입니다;어떻게 해야 루트로 뺄수 있을까요? 혹시 htaccess 문제인가도 싶고..; |
|||
| 다음글 | 또 질문이네요 ㅎㅎ; (5) | ||
| 이전글 | ci세상님께 물어봤었는데..header, content... (10) | ||
|
ci세상
/
2009/08/27 12:06:10 /
추천
0
요렇게 하시면요?
|
|
터프키드
/
2009/08/27 13:21:20 /
추천
0
왜 아예 먹히지가 않죠? ㅎㅎ 파일이 없다고 오류를 뱉어야하는데
ci세상님이 말씀하신대로 했는데 그냥 잘 나와요 아직도 application/views 를 참조하는거 같아요..;; MY_Loader 때문인가요..; |
|
ci세상
/
2009/08/27 13:33:04 /
추천
0
가급적 코어는 만지지 마시구요 코어 대체를 해서 사용하시길 권장해 드리구요...
function CI_Loader()
{
$this->_ci_is_php5 = (floor(phpversion()) >= 5) ? TRUE : FALSE;
$this->_ci_view_path = 'templates/';
$this->_ci_ob_level = ob_get_level();
log_message('debug', "Loader Class Initialized");
}에 패스를 변경하시면 될것 같습니다.혹은 index.php 에서 아래와 같이 변경해서 $system_folder = ""; $application_folder = "templates";
exit; |
|
터프키드
/
2009/08/27 13:45:30 /
추천
0
어떻게 해도 계속 application/views 를 참조하네요
그래서
class MY_Loader extends CI_Loader{
function __construct()
{
parent::CI_Loader();
$this->_ci_view_path = "template/";
echo $this->_ci_view_path;
}
}
이렇게 해서 찍어봤는데요이땐 template/ 로 나오긴 하는데 그래고 시스템에선 계속 application/views 를 참조하네요 ㅎㅎ 이게 뭔일인지..; system/libraries/Loader.php (코어파일) 에서 $this->_ci_view_path;를 주석걸어도 에러도 안떨어지고 계속 어플/뷰 참조합니다 삭제 해도 계속 참조하고요 이게 어디서 계속 초기화 하나봐요..;; |
|
터프키드
/
2009/08/27 14:07:07 /
추천
0
절 때려주세요..
ㅠㅠ Template_ 연동해놓고 거기다가 강제 주소로 /system/application/views 넣어둬서 ㅠㅠ 계속 거길 참조했네요 전 완전 바봅니다.. 아 이럴땐 죽고싶네요 흑 지금 load->view 를 사용하지 않는데 말이죠! ㅠㅠ |
|
ci세상
/
2009/08/27 14:12:17 /
추천
0
템플릿 적용하시다가 기진맥진 하시겠습니다. ㅎㅎ 어떤 프로젝트 하시는데요?
|
|
터프키드
/
2009/08/27 15:03:16 /
추천
0
ci세상
회사 자체 서비스 입니다^^; 죽겠어요ㅠㅠ |
|
ci세상
/
2009/08/27 15:31:20 /
추천
0
저도 회사 자체 서비스 인데요 완전 제멋대로 하는데요 ^^
가끔은 심플한 생각도 좋을때가 있을것 같습니다. ~~ |