[Tips] 레이아웃(외부페이지)에서 XE의 게시판 갯수를 구하는 법
2018.12.09 14:07
119
0
https://eond.com/412506
object(HotopayModel)#817 (23) { ["error"]=> int(0) ["message"]=> string(7) "success" ["variables"]=> array(0) { } ["httpStatusCode"]=> int(200) ["module"]=> string(7) "hotopay" ["module_info"]=> NULL ["origin_module_info"]=> NULL ["module_config"]=> NULL ["module_path"]=> string(52) "/home/eond/web/eond.com/public_html/modules/hotopay/" ["xml_info"]=> NULL ["module_srl"]=> NULL ["mid"]=> NULL ["act"]=> NULL ["template_path"]=> NULL ["template_file"]=> NULL ["layout_path"]=> NULL ["layout_file"]=> NULL ["edited_layout_file"]=> NULL ["stop_proc"]=> bool(false) ["user"]=> object(Rhymix\Framework\Helpers\SessionHelper)#816 (20) { ["member_srl"]=> int(0) ["user_id"]=> NULL ["user_name"]=> NULL ["nick_name"]=> NULL ["email_address"]=> NULL ["phone_number"]=> NULL ["homepage"]=> NULL ["blog"]=> NULL ["birthday"]=> NULL ["denied"]=> NULL ["status"]=> NULL ["is_admin"]=> string(1) "N" ["is_site_admin"]=> NULL ["profile_image"]=> NULL ["image_name"]=> NULL ["image_mark"]=> NULL ["signature"]=> NULL ["description"]=> NULL ["group_list"]=> array(0) { } ["menu_list"]=> array(0) { } } ["request"]=> object(Rhymix\Framework\Request)#10 (13) { ["method"]=> string(3) "GET" ["compat_method"]=> string(3) "GET" ["url"]=> string(17) "xe/412506/page/19" ["hostname"]=> string(8) "eond.com" ["domain"]=> NULL ["protocol"]=> string(5) "https" ["callback_function"]=> string(0) "" ["_route_status":protected]=> int(200) ["_route_options":protected]=> object(stdClass)#11 (5) { ["cache_control"]=> bool(true) ["check_csrf"]=> bool(true) ["is_forwarded"]=> bool(false) ["is_indexable"]=> bool(true) ["enable_session"]=> bool(true) } ["module"]=> string(5) "board" ["mid"]=> string(2) "xe" ["act"]=> string(16) "dispBoardContent" ["args"]=> array(10) { ["category"]=> string(5) "35024" ["height"]=> string(4) "100%" ["iframe"]=> string(4) "true" ["listStyle"]=> string(6) "viewer" ["sort_index"]=> string(12) "readed_count" ["width"]=> string(4) "100%" ["document_srl"]=> string(6) "412506" ["page"]=> int(1) ["mid"]=> string(2) "xe" ["act"]=> string(16) "dispBoardContent" } } ["ajaxRequestMethod"]=> array(2) { [0]=> string(6) "XMLRPC" [1]=> string(4) "JSON" } ["gzhandler_enable"]=> bool(true) }

레이아웃(외부페이지)에서 XE의 게시판 갯수를 구하는 법

{@
   // $oDB = &DB::getInstance();
   // $oModuleModel = &getModel('module');
   // $oDocumentModel = getModel('document');
   // $module_info = $oModuleModel->getModuleInfoByMid($val1['url']);
   // $docCount = $oDocumentModel->getDocumentCount('35001');
   
   // $oDocumentModel = &getModel('document'); // 문서객체 선언(게시물정보 객체 선언)
   // $args = new stdClass();
   // $args->list_count = 50; // 리스트갯수
   // $args->module_srl = 1234; // 불러올 게시물 모듈번호
   // $output = $oDocumentModel->getDocumentList($args, true);
   // $document_list = $output->data;
}

{@
//$mid = notice;
//$oModuleModel = getModel('module');
//$module_srl = $oModuleModel->getModuleSrlByMid($mid);
//
//$args = new stdClass();
//$args->module_srl = $module_srl;
//$args->list_count = 8;
//$list = executeQuery('document.getDocumentList',$args)->data;
//
//$output = $oDocumentModel->getDocumentList($args, true);
//$document_list = $output->data;
}

{@
   $oTmpModuleModel = &getModel('module');
   }
{@
   $oTmpDocumentModel = &getModel('document');
   }
{@
   $menuModuleInfo = $oTmpModuleModel->getModuleInfoByMid($val['url']);
   }
{@
   $module_srl_xe = '35001';
   //$docCount = $oTmpDocumentModel->getDocumentCount($menuModuleInfo->module_srl);
   $DocCountXe = $oTmpDocumentModel->getDocumentCount($module_srl_xe);
   }
{$DocCountXe}


참고 : https://www.xpressengine.com/tip/5158873

{@
$oModuleModel = &getModel('module'); // 오브젝트모듈모델 = 겟모델('모듈') // 1. 객체(대상)가 되는 모델을 지정함(여기서는 '모듈')
$oDocumentModel = &getModel('document'); //오브젝트도큐먼트모델 = 겟모델('도큐먼트') // 2. 객체(대상)이 되는 모델을 '도큐먼트' 모듈을 지정함.

$module_srl_xe = '35001'; // 3. 모듈 srl을 지정함.
$DocCountXE = $oDocumentModel->getDocumentCount($module_srl_xe); // 4. 지정한 모듈의 getDocumentCount를 호출함. getDocumentCount는 document 모듈의 쿼리문에 있어서 활용 가능함.
}


정리한 코드는 다음과 같습니다.

{@
$oModuleModel = &getModel('module'); // 오브젝트모듈모델 = 겟모델('모듈') // 1. 객체(대상)가 되는 모델을 지정함(여기서는 '모듈')
$oDocumentModel = &getModel('document'); //오브젝트도큐먼트모델 = 겟모델('도큐먼트') // 2. 객체(대상)이 되는 모델을 '도큐먼트' 모듈을 지정함.

$module_srl_xe = '35001'; // 3. 모듈 srl을 지정함.
$DocCountXE = $oDocumentModel->getDocumentCount($module_srl_xe); // 4. 지정한 모듈의 getDocumentCount를 호출함. getDocumentCount는 document 모듈의 쿼리문에 있어서 활용 가능함.

$module_srl_xe3 = '35001';
$DocCountXE3 = $oDocumentModel->getDocumentCount($module_srl_xe3);

$module_srl_wp = '35001';
$DocCountWP = $oDocumentModel->getDocumentCount($module_srl_wp);

$module_srl_gn = '35001';
$DocCountGN = $oDocumentModel->getDocumentCount($module_srl_gn);

$module_srl_zb = '35001';
$DocCountZB = $oDocumentModel->getDocumentCount($module_srl_zb);

$module_srl_cf = '35001';
$DocCountCF = $oDocumentModel->getDocumentCount($module_srl_cf);

$module_srl_gd = '35001';
$DocCountGD = $oDocumentModel->getDocumentCount($module_srl_gd);

$module_srl_fm = '35001';
$DocCountFM = $oDocumentModel->getDocumentCount($module_srl_fm);

$module_srl_qa = '35001';
$DocCountQA = $oDocumentModel->getDocumentCount($module_srl_qa);

}
{$DocCountXE}


이렇게 하면 각 게시판의 게시물수를 카운트할 수가 있습니다.

라이믹스는 이온디와 함께

닫기

마이페이지

로그인을 해주세요

네이버로 로그인