Q&A

댓글 5

  • 2019.12.17 05:28 #1305900
    https://github.com/rhymix/rhymix/blob/master/modules/document/document.model.php#L647

    쓰면됩니다.

    getModel('document')->getCategory(Context::get('category_srl'));
  • 2019.12.17 05:39 #1305913
    $category_info = getModel('document')->getCategory(Context::get('category_srl'));
    $category_title = sprintf('[%s]',$category_info->title);

    요런식으로 하니 되네요. 감사합니다.
  • 2019.12.17 06:07 #1305930
    추가로 질문을 드려도 될까요???

    Context::get('category_srl')

    2차 카테고리 인데요. 2차 카테고리가 다른 시도와 겹치는 경우가 있어서

    1,2차 카테고리를 함게 출력해 주려면 코드를 어떻게 추가하면 좋을까요???

    1차 - 2차 카테고리명을 모두 알아내야 할 것 같습니다. 카테고리번호는 2차 카테고리 번호만 알고 있습니다.
  • 2019.12.17 06:37 #1305938
    $category_info의 parent_srl을 이용해서 또다시 카테고리 정보를 얻어오면 될것 같습니다.

    {@
    $oDocumentModel = getModel('document');
    $second_category = $oDocumentModel->getCategory(Context::get('category_srl'));
    if($second_category->parent_srl != 0) $first_category = $oDocumentModel->getCategory($second_category->parent_srl);
    }

    {$first_category->title}, {$second_category->title} 처럼 사용할수 있습니다.
    (아직 테스트는 못해본 코드라 문제가 있을수 있습니다)
  • 2019.12.17 06:50 #1305957
    감사합니다. 잘되네요~~~