애드온이 게시판 목록에서 약간 오류를 일으켜서 

글 읽기 화면에서만 적용되도록 하다고...

 

$oDocument = Context::get('oDocument');
if(!$oDocument) return;

 

이렇게 했는데...  목록에서도 해당 애드온 영향을 받아서 문제가 발생하더라구요..

 

그래서 비회원들에게 문제가 생겨서 문제가 생기는  코드 앞에

 

if(!Context::get('is_logged')) return;

 

이걸로 비회원에게는 해당 코드가 동작하지 않도록 임시 처리 했습니다.

 

 

목록에서는 리턴시키려면 뭐가 빠진걸까요 ??

 

 

목록에서 애드온 동작을 리턴시키지 못하니까..

if($addon_info->alert_writer == 'Y' && Context::get ('logged_info')->member_srl == $oDocument->get ('member_srl')){

 

이부분에서 비회원에게 오류가 생기더라구요..

 

 

  • ?

    act가 dispBoardContent이고 document_srl값 존재 유무로 글 목록인지 아닌지 판별할 수 있을겁니다

  • ? profile
    $oDocument = Context::get('oDocument');
    if(!$oDocument) return;

    이것으로는 안되는건가요 ?
  • profile ?

     

    $document_srl = Context::get("document_srl");

    if($this->act == " dispBoardContent" && !$document_srl){

        return;

    }

  • ? profile
    일단 if(!$document_srl) return;
    이걸로 되는 듯 한데 말씀해주신 코드로 고치겠습니다. 감사합니다.
  • ? profile
    $document_srl = Context::get("document_srl");
    if(!$document_srl) return;

    이렇게 넣었더니 목록이던 글읽기 화면이던 다 리턴되는 듯 하네요...
  • profile ?
    document_srl 값을 못가져온다는 말인데 음..
  • ? profile
    $oDocument = Context::get('oDocument');
    if(!$oDocument->document_srl) return;

    요거는 어떨까요 ? 에러도 안나고 일단 리턴은 되는 듯 합니다. 글 읽기에서는 리턴이 안되고 목록에서는 리턴이 잘 되는 거 같습니다.
  • profile ?

    oDocument는 지역변수인 것 같은데 저게 가져오기가 될려나 ㄷㄷ
    한번 debugPrint($oDocument)로 체크해보는게 좋을듯 해요

  • profile
    called_position이 잘못된것같은데 called_position이 어떻게 되나요?
  • profile profile
    현재 비회원이 게시판 목록에 접근시 동작하지 않아야 할 코드가 동작하는 부분은...

    if($addon_info->alert_writer == 'Y' && Context::get ('logged_info')->member_srl == $oDocument->get ('member_srl')){

    이 코드구요.

    위 코드는 called_position 안쪽으로 들어가 있습니다.
    그래서 일단 위 문제되는 코드 바로 위에 if(!Context::get('is_logged')) return; 비회원만 리턴 시켜도 문제는 없는데요. if(!Context::get('is_logged')) return; 없이 목록 자체에서 해당 코드가 문제를 일으키지 않게 called_positioncalled_position 보다 위에서 목록에서 동작하지 않게 리턴 시키려 한 것입니다.


    $called_position == 'before_display_content' && Context::getResponseMethod() == 'HTML' && $module_info->module=='board'

    위와 같이 되어 있구요.

    현재 윗 댓글에 언급한

    $oDocument = Context::get('oDocument');
    if(!$oDocument->document_srl) return;

    위 코드를 애드온 시작 초기에 넣었더니 목록에서는 리턴이 잘 되고 게시글 읽는 화면에서는 잘 동작합니다.
    문제가 있을까요 ?
  • profile profile
    documentItem Object
    (
    [document_srl] => 0
    [lang_code] =>
    [grant_cache] =>
    [allow_trackback_status] =>
    [columnList] => Array
    (
    )

    [allowscriptaccessList] => Array
    (
    )

    [allowscriptaccessKey] => 0
    [uploadedFiles] => Array
    (
    )

    [error] => 0
    [message] => success
    [variables] => Array
    (
    [module_srl] => 200
    )

    [httpStatusCode] => 200
    )

    oDocument도 잘 불러오네요. 문제없습니다.
  • profile profile
    사용할 수 있는 함수를 쉽게 확인하려면

    echo print_r(Context::getAll());
    와 같이 쓰면 편합니다.
  • profile profile
    감사합니다.