묻고답하기

 

 제목과 같은 방식으로 mid가 존재하지 않는 상태에서 module과 act만 가진 상태에서 본인이 선택한 레이아웃을 입히려면 어떻게 해야 하는지 조언을 구합니다.

 

 다른 말로 하면 특정 mid가 존재하는 상태에서도 강제로 다른 레이아웃으로 바꿔서 보여주는 방식이 궁금합니다.

 

 모듈 config을 저장하고 가져오는 방식은 rss 모듈을 참고했습니다.

 

approach.admin.view.php의 dispApproachAdminIndex():

본 모듈의 관리자 설정 화면을 보여주는 view 메서드 입니다.

/**
 * In case an administrator page has been initialized
 *
 * @return Object
 */
function dispApproachAdminIndex() {
// 필요한 Model Import
$oModuleModel = getModel('module');

$total_config = $oModuleModel->getModuleConfig('approach');

// total_config 설정
if(!$total_config) $total_config = new stdClass();

// Context를 set 한다.
Context::set('total_config', $total_config);

// Security 설정
$security = new Security();
$security->encodeHTML('total_config..');

// Template 설정
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('index');

$oLayoutModel = &getModel('layout');
Context::set('layout_list', $oLayoutModel->getLayoutList());
}

 

approach.admin.controller.php의 procApproachAdminInsertConfig():

관리자 화면에서 받아온 값을 module의 config에 저장 

/**
 * All module configurations
 *
 * @return void
 */
function procApproachAdminInsertConfig()
{
$oModuleModel = getModel('module');
$total_config = $oModuleModel->getModuleConfig('approach');

$config_vars = Context::getRequestVars();

// 실제적으로 Module의 Config이 저장되는 함수
$output = $this->setFeedConfig($config_vars);

// 결과출력 메세지 처리
$message = Context::getLang('success_updated');
$this->setMessage($alt_message, 'info');

// Redirect 처리
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispApproachAdminIndex');
$this->setRedirectUrl($returnUrl);
}

 

tpl/index.html:

본 모듈의 관리자 화면 템플릿 파일

<div class="x_page-header">
<h1>
{$lang->approach}
<span class="path" cond="$module_info->mid">
> <a href="{getSiteUrl($module_info->domain,'','mid',$module_info->mid)}" target="_blank"|cond="$module=='admin'">{$module_info->mid}</a><block cond="$module_info->is_default=='Y'">({$lang->is_default})</block>
</span>
<a href="#aboutModule" class="x_icon-question-sign" data-toggle cond="!$module_info->mid"></a>
</h1>
</div>
<p id="aboutModule" class="x_alert x_alert-info" cond="!$module_info->mid" hidden>{nl2br($lang->about_approach)}</p>

<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/approach/tpl/index/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>

<section class="section">
<h1>{$lang->is_default}</h1>
<form ruleset="insertConfig" action="./" method="post" enctype="multipart/form-data" class="x_form-horizontal">
<input type="hidden" name="module" value="approach" />
<input type="hidden" name="act" value="procApproachAdminInsertConfig" />
<input type="hidden" name="xe_validator_id" value="modules/approach/tpl/index/1" />

<div class="x_control-group">
<label class="x_control-label" for="layout_srl">{$lang->layout}</label>
<div class="x_controls">
<select name="layout_srl" id="layout_srl">
<option value="0">{$lang->notuse}</option>
<option loop="$layout_list => $key, $val" value="{$val->layout_srl}" selected="selected"|cond="$total_config->layout_srl== $val->layout_srl">{$val->title} ({$val->layout})</option>
</select>
<a href="#layout_help" class="x_icon-question-sign" data-toggle>{$lang->help}</a>
<p id="layout_help" class="x_help-block" hidden>{$lang->about_layout}</p>
</div>
</div>

<div class="btnArea x_clearfix">
<button type="submit" class="x_btn x_btn-primary x_pull-right">{$lang->cmd_save}</button>
</div>

</form>
</section>

 

approach.view.php의 init():

관리자 화면이 아닌 모듈의 일반 view의 초기화 메서드

// view 초기화
function init() {
$oDocumentModel = &getModel('document');

// 스킨을 설정하는 부분.
$template_path = sprintf("%sskins/%s/",$this->module_path, $this->module_info->skin);
if(!is_dir($template_path)||!$this->module_info->skin) {
$this->module_info->skin = 'xe_approach_official';
$template_path = sprintf("%sskins/%s/",$this->module_path, $this->module_info->skin);
}
$this->setTemplatePath($template_path);
$this->setTemplateFile(strtolower(str_replace('dispApproach','',$this->act)));

$oModuleModel = getModel('module');
$total_config = $oModuleModel->getModuleConfig('approach');

// 레이아웃의 정보를 가져옴
$layout_srl = $total_config->layout_srl;
if($layout_srl) {
$oLayoutModel = &getModel('layout');
$layout_info = $oLayoutModel->getLayout($layout_srl);

if(!$layout_info) return;

$this->setLayoutPath($layout_info->path);
$this->setLayoutFile('layout.html');
}
}

 

 $total_config에 해당하는 부분이 관리자 화면에서 저장한 layout_srl 값이 들어있구요.

 그걸 바탕으로 위와 같은 방식으로 시도해보았는데 아래와 같이 화면이 나옵니다. 해당 레이아웃이 커스텀 설정 값이 컴파일 된 값이 아닌 순수 레이아웃 파일 자체만 씌워주는 것 같은데요.

 

캡처.PNG

 

 저와 같은 시도를 해보신 분이 없으신지 궁금합니다. 각 mid에 대한 레이아웃 셋팅이 어디에서 핸들링 되고 있는지 몰라서요. mid가 존재하지 않는 상태에서 모듈 자체에 대해서 레이아웃을 씌우고 싶은데 조언을 구합니다.

 

 감사합니다.

글쓴이 제목 최종 글
XE 공지 글 쓰기,삭제 운영방식 변경 공지 [16] 2019.03.05 by 남기남
불금 알림센터에서 심플스트랩 쓸때... [3] 2015.06.13 by 불금
이온디 예전 제로보드 게시판 스킨 중에서 혹시 이런 느낌의 게시판 없었나요? ㅠㅠ [1] 2015.06.13 by 이온디
지원필요 에디터 오류.. [2] file 2015.06.13 by 로뎀나무57d9f
공수래 위젯에서 SESSION등을 이용해 초기 설정을 유지하는 방법?  
NEXlak 회원가입 문제 [1] 2015.06.13 by 마야
kjsky88 메뉴 가운데로 정렬 어떻게 하나요? [1] file 2015.06.13 by 불금
땀모 데이터이전 툴 에러 후 어찌해야됩니까? export [4] file 2015.06.13 by 땀모
맹이01 게시물 작성후, (등록) 버튼 누르면;; 반응이 없어요... (작성은됨..) [3] 2015.06.13 by Tommy74
맥문동 pc , 모바일, 앱으로 접속을 알수 있는 조건문 혹시 아시는 분 계신가요? [8] 2015.06.13 by 맥문동
건즈 코어 1.8.3 설치후 로그인 풀림 - 관리자 모드에 들어갈 수 없습니다. [1] 2015.06.13 by 건즈
맥문동 애드온 설정 내용을 완전히 삭제 할 수 없을까요? [4] file 2015.06.13 by 맥문동
착한동구 LoginXE 질문좀 할게요 [6] 2015.06.13 by 착한동구
땀모 데이터 이전툴 사용해서 데이터이전 [첨부파일] [2] 2015.06.13 by 땀모
윤여 PHP MySQL library version 관련 문의 드립니다. [3] 2015.06.13 by 기진곰
개누 관리자페이지가 갑자기 fetal 에러 뜨면서 안됩니다 ㅜㅜ [7] 2015.06.13 by 불금
NEXlak 도와주세요 ㅠㅠ [4] 2015.06.13 by 불금
한스김 Xedition 레이아웃에 포함된 슬라이드 관련.. [1] 2015.06.13 by ehii
착한동구 게시판에 이미지 첨부파일 목록 안보이게 하려면요 [11] 2015.06.13 by 착한동구
시니시즘 http://사이트.com/index.php?module=나의모듈&act=나의액션 [1] file 2015.06.13 by 시니시즘
불금 어떻게 하면 자동 저장되었습니다 에 초 단위를 표시할수 있을까요? [1] file 2015.06.13 by 불금
땀모 통합검색에서 글씨색상과 배경색상때문에 글이 잘 안보입니다. [1] file 2015.06.14 by 불금
hanapunin admin account [1] 2015.06.14 by I-JEX
thdwjdtjr 문서를 다른 이름으로 저장 또는 복사 금지(제한)  
천상의문c622f XE 설치 후 default 레이아웃의 초기화면에 있는 file  
푸주간 FileHandler.class.php on line 574 이 오류는 계속 되네요.. [4] file 2015.06.14 by 푸주간
시니시즘 데이터베이스에서 Index의 개념에 대해서  
상해파 특정 검색어를 검색되지 않게 하는 방법은?  
이주연743 Capcha 틀렸을때 처음부터 다시 말고 기회를 한번만 더...  
flowerrain 이런 비슷한 자료가 배포된게 있나요? [4] file 2015.06.14 by flowerrain
XE모듈 무슨 레이아웃인가요? [1] 2015.06.14 by 우랑탕탕이