작업 중인 에디터 컴포넌트의 클래스 파일의 일부입니다.
function getTemplate() { $template = Context::get('template'); // 여기서 template은 컴포넌트로 불러올 템플릿 id값 $template_path = $this->component_path.'templates/'.$template; $template_file = 'index.html'; // $template에 해당하는 디렉토리와 파일이 다 존재하고 있음 $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($template_path, $template_file); }
그리고 아래는 위의 함수를 팝업창에서 ajax로 불러주는 부분입니다.
function insertTemplate(template) { // 여기서 template은 컴포넌트로 불러올 템플릿의 id값 $.ajax({ type : 'post', url : 'index.php', dataType : 'html', data : { module :'editor', act : 'procEditorCall', component :'ap_template', method : 'getTemplate', template : template }, success : function(data) { console.log(data); } }); }
라이믹스에서는 이렇게 할 때 지정된 루트의 index.html을 라이믹스 형태에 맞게 컴파일해서 data 값이 주르륵 뜨거든요.
그런데 XE에서는 body태그에 어떤 내용도 뜨지 않습니다. 그렇다고 에러가 나는 것도 아니구요.
클래스 파일에서 함수 설정할 때 잘못된 점이 있는 거겠죠?
덧. 참고로 테스트 환경은
- 라이믹스 1.9.6 / PHP 버전: 7.0.22
- XE 1.9.6 / PHP 버전: 5.5
입니다. (설마 PHP 때문은 아니겠죠...)
그리고 XE와 라이믹스의 입출력 구조가 상당히 다르니, $.ajax() 말고 내장함수인 exec_json()를 사용하는 것이 호환에 유리합니다.