작업 중인 에디터 컴포넌트의 클래스 파일의 일부입니다.
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);
}
{
$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);
}
});
}
$.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 때문은 아니겠죠...)

윤삼
Lv. 19
아무래도 중급 초반 수준의 코딩 오타쿠인 것 같습니다.
댓글 3
그리고 XE와 라이믹스의 입출력 구조가 상당히 다르니, $.ajax() 말고 내장함수인 exec_json()를 사용하는 것이 호환에 유리합니다.
완전 잘 됩니다! 감사해요~☆
말씀하신대로 exec_json으로 마무리도 잘 했구요ㅎㅎ
그나저나 이번 일로 라이믹스의 넓은 아량을 느낄 수 있었네요ㅋㅋ