if(!defined("__XE__")) exit();
$document_srl = Context::get('document_srl');
$oDocumentModel = getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl);
if($act == 'procCommentVoteUp' && $called_position == 'after_module_proc' && $oDocument->get('module_srl')=='64695') {
코드
}
위와 같이 작성해서 작동이 되는줄 알았더니 $oDocument->get('module_srl')=='64695' 이부분이 적용이 되지 않아 모든 문서가 작동하지 않는 상황이네요.
어디에 오류가 있는건가요?
댓글 11
그리고 저렇게 하시면 $oDcoument 뽑아오는 구문이 애드온 호출시점마다 반복될 거 같아요.
$comment_srl = Context::get('target_srl'); //procCommentVoteUp에서 받아오는 값을 가져온다.
$oCommentModel = getModel('comment');
$oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE);
$member_srl = $oComment->get('member_srl'); //댓글 작성자의 유저번호
그걸 $this->module_srl로 받아와서 필요한 부분에 조건을 걸면 될 것 같은데요.
if(!defined("__XE__")) exit();
if($act == 'procCommentVoteUp' && $called_position == 'after_module_proc' && Context::get('document_srl')) {
$document_srl = Context::get('document_srl');
$oDocumentModel = getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl);
if($oDocument->get('module_srl') != '64695') return;
코드
}
그럼
$document_srl = Context::get('document_srl');
$oDocumentModel = getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl);
if($oDocument->get('module_srl') != '64695') return;
이 위치가 영향을 주는건가요?
$document_srl = Context::get('document_srl');
$oDocumentModel = getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl);
if($oDocument->get('module_srl') != '64695') return;
이 코드는 애드온 최상단에 넣어봤는데 안되더라구요. 모듈번호는 정확히 넣었는데요.
말씀 하신 위치로 변경해 보고 확인해 보겠습니다.
코드 위치를 바꿔봐도 다 안되는 것 보니 어딘가 오류가 있나봐요...
64695 번호에 소속된 문서에서만 동작되어야 하는데 지금 모두 리턴되어 버리네요...
$comment_srl = Context::get('target_srl'); //procCommentVoteUp에서 받아오는 값을 가져온다.
$oCommentModel = getModel('comment');
$oComment = $oCommentModel->getComment($comment_srl, FALSE, FALSE);
$member_srl = $oComment->get('member_srl'); //댓글 작성자의 유저번호
if($oComment->get('module_srl') != '64695') return;
이렇게 기존코드에서 댓글로 모듈번호를 불러오니 잘 되네요..
다른 애드온에서 응용할때 약간 퀴즈가 남은 상황이네요 ㅋ
담변 감사합니다.
$oModuleModel = getModel('module');
$ggmodule_info = $oModuleModel->getModuleInfoByDocumentSrl($document_srl);
$ggmodule_srl = $ggmodule_info->module_srl;
한번 해보실래요?