웹마스터 팁

안드로이드 푸시 앱 연동 모듈을 개발하면서 몇가지 직면한 문제들을 해결한 팁을 공개하고자 합니다.

제가 잘 몰라서 우회적으로 해결한 경우인데,

문제는 function triggerAfterInsertDocument(&$obj) 안에서

$oDocumentModel = getModel('document');      
$oDocument = $oDocumentModel->getDocument($document_srl);

이렇게 해서 현재 document 핸들러를 가져온 뒤, 이것으로 작업을 할 때 아래와 같은 첨부파일과 관련된 메소드가 전혀 작동하지 않는다는 것입니다.

 

$file_list =  $oDocument->getUploadedFiles();

 

이런 경우 저는 이렇게 해결했습니다. 바로 triggerBeforeInsertDocument(&$obj) 글이 등록되기 전 트리거를 가져와서 거기서 첨부파일을 받아놓고 그 다음에 triggerAfterInsertDocument(&$obj)으로 첨부파일 관련 변수를 넘겨줌으로 해결했습니다.

 

function triggerBeforeInsertDocument(&$obj)
 {
  $document_srl = $obj->document_srl;

  if($GLOBALS['__androidpushapp__'][$document_srl]) unset($GLOBALS['__androidpushapp__'][$document_srl]);

  $sortIndex = 'file_srl';  
  $args = new stdClass();
  $args->upload_target_srl = $document_srl;
  $args->isvalid = "N";
  $args->sort_index = $sortIndex;

  $output = executeQueryArray("file.getFiles", $args);

  $file_list = $output->data;

  if($file_list && !is_array($file_list)) $file_list = array($file_list);

  $file_count = count($file_list);
  for($i=0;$i<$file_count;$i++)
  {
   $file = $file_list[$i];
   $file->source_filename = stripslashes($file->source_filename);
   $file->download_url = $this->getDownloadUrl($file->file_srl, $file->sid, $file->module_srl);
   $file_list[$i] = $file;
  }

  $GLOBALS['__androidpushapp__'][$document_srl] = $file_list;
 } 
 

 function triggerAfterInsertDocument(&$obj)
 { 

...

    $arr_file=$GLOBALS['__androidpushapp__'][$document_srl];

...

}

 

저처럼 트리거에서 첨부파일을 가져올 수 없어서 애먹는 분이 계실까봐 도움이 되었으면 하는 바램으로 허접한 팁을 적었습니다.

 

제목 글쓴이 날짜
XE 서버 이전할 때 통채로 압축해서 옮기는 완벽한 방법-로그인, 첨부파일문제 해결 [5] 웰빙샵 지영 2009.09.15
손님이 비밀글 작성한 직후에도 글 보려면 반드시 비밀번호 넣게 하는 방법 [1] sejin7940 2014.06.18
php로 간단하게 신규쪽지(읽지않은쪽지) 표시해주기 [2] 졸라맨 2014.07.23
XE 1.8 대응 apache 2.2 / php 5.5 / MariaDB 10 설치 [11] 간장게장같은남자 2015.04.19
php 5.6 이상에서 사이트 메뉴 편집 등 오류 발생시 YJSoft 2015.08.12
위젯수정시 _getContent method is not exists 에러 뜨는 문제 [2] 황비 2014.11.14
[XE수정] 관리자페이지 회원리스트를 내맘대로 브레인630 2015.08.11
[XE수정] '새버전을 업데이트...'이 부분이 눈에 거슬리면... [1] 브레인630 2015.08.11
CSS 및 JAVASCRIPT 소스 효과적으로 숨기기. [9] LaughLikeCrazy 2007.06.16
태그 (Tag) 관련글 보여줄 때 상단에 선택된 태그 보여주는 방법 [1] calko 2015.08.08
DB에서 직접 시퀀스 생성하기 [3] 기진곰 2015.07.18
FTP로 폴더가 삭제가 안될때~! [6] file 웹엔진 2012.01.30
사이트접속시 제로보드XE폴더로 이동되게 하는 쉬운방법 [8] 부찬™ 2007.08.17
member 모듈 메일인증을 사용할때 모바일 기본스킨에서 회원가입 후 이메일 발송 안내 띄우기 [2] file 후하니 2015.08.01
새로고침 없는 실시간 웹서비스를 위한 기술과 간략한 역사(?) [1] onTrust 2015.07.27
Startssl 설치과정!! [83] file 제이엔지 2012.08.13
홈페이지 제작 시 점검사항 15가지 [1] 유래유거 2015.06.29
[실험팁] XE 고용량/큰사진 썸네일 깨지는 것 해결 socialskyo 2015.07.20
레이아웃 메뉴에서 메뉴옆에 글수 표시하기 반걸 2015.07.20
config 파일을 일반 유저가 쓸 수 없는 문제 해결법 [15] wkp 2015.07.09