Q&A

필터 쓰다가 룰셋공부겸... 만들어보고있는 모듈이있는데 관리자 측에서 모듈생성하려니 등록누르면 백지가 되어버리네요 ㅎㅎ.. dispSpmshopAdminInsert 함수에 디버그 //var_dump(); //return new Object(-1,); 찍어도 값이안뜨는걸보니..

함수읽기전에 문제가 생긴듯한데... 이럴땐 참 난감하네요 ;ㅂ;... 혹시 보기 불편하실까봐 장문은 캡쳐하였습니다

필터에서.. 룰셋으로 옴겨가는게 이렇게 힘들줄랴...

 

액션추가

<action name="procSpmshopAdminInsert" type="controller" standalone="true" />

<action name="procSpmshopAdminInsert" type="controller" standalone="true" ruleset="adminInsert_ruleset" />

 

룰셋 추가

파일명: adminInsert_ruleset

<?xml version="1.0" encoding="utf-8"?>
<ruleset version="1.5.0">
    <fields>
        <field name="mid" required="true" length="1:40" rule="alpha_number" />
        <field name="browser_title" required="true" length="1:250" />
    </fields>
</ruleset>

 

 

admin 컨트롤러

 

function procSpmshopAdminInsert() 
        {

            //var_dump("dd"); 
            //return new Object(-1,"dd");
            // module 모듈의 model/controller 객체 생성
            $oModuleController = &getController('module');
            $oModuleModel = &getModel('module');

            // request 값을 모두 받음
            $args = Context::getRequestVars();
            $args->module = 'spmshop';

            // module_srl이 넘어오면 원 모듈이 있는지 확인
            if($args->module_srl) 
            {
                $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl);
                if($module_info->module_srl != $args->module_srl) unset($args->module_srl);
            }

            // module_srl 값의 존재여부에 따라 insert/update
            if(!$args->module_srl) 
            {
                $output = $oModuleController->insertModule($args);
                $msg_code = 'success_registed';
            }
            else 
            {
                $output = $oModuleController->updateModule($args);
                $msg_code = 'success_updated';
            }
            // 오류가 있으면 리턴
            if(!$output->toBool()) return $output;

            // 메시지 등록
            $this->setMessage($msg_code);

            // success_return_url의 존재여부에 따라 URL 재지정
            if (Context::get('success_return_url')){
                $this->setRedirectUrl(Context::get('success_return_url'));
            }
            else
            {
                $this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpmshopAdminList', 'module_srl', $output->get('module_srl')));
            }
        }

 

admin_insert.html

 

<include target="header.html" />

<form ruleset="adminInsert_ruleset" action="/" method="post" enctype="multipart/form-data" class="form">
    <input type="hidden" name="module" value="spmshop" />
    <input type="hidden" name="act" value="procSpmshopAdminInsert" />
    <input type="hidden" name="page" value="{$page}" />
    <input type="hidden" name="module_srl" value="{$module_info->module_srl}" />
    <input cond="$mid || $module_srl" type="hidden" name="success_return_url" value="{getRequestUriByServerEnviroment()}" />

    <table cellspacing="0" class="rowTable">
    <!-- 모듈 이름 -->
    <tr>
        <th scope="row">{$lang->mid}</th>
        <td>
            <input type="text" name="mid" value="{$module_info->mid}" />
            <p>{$lang->about_mid}</p>
        </td>
    </tr>
    <!-- 모듈 분류 -->
    <tr>
        <th scope="row">{$lang->module_category}</th>
        <td>
            <select name="module_category_srl">
                <option value="0">{$lang->notuse}</option>
                <!--@foreach($module_category as $key => $val)-->
                <option value="{$key}" <!--@if($module_info->module_category_srl==$key)-->selected="selected"<!--@end-->>{$val->title}</option>
                <!--@end-->
            </select>
            <p>{$lang->about_module_category}</p>
        </td>
    </tr>
    <!-- 브라우저 제목 -->
    <tr>
        <th scope="row">{$lang->browser_title}</th>
        <td>
            <input type="text" name="browser_title" value="{htmlspecialchars($module_info->browser_title)}"  class="inputTypeText w400" id="browser_title"/>
            <a href="{getUrl('','module','module','act','dispModuleAdminLangcode','target','browser_title')}" onclick="popopen(this.href);return false;" class="buttonSet buttonSetting"><span>{$lang->cmd_find_langcode}</span></a>
            <p>{$lang->about_browser_title}</p>
        </td>
    </tr>
    <!-- 레이아웃 옵션 -->
    <tr>
        <th scope="row">{$lang->layout}</th>
        <td>
            <select name="layout_srl">
            <option value="0">{$lang->notuse}</option>
            <!--@foreach($layout_list as $key => $val)-->
            <option value="{$val->layout_srl}" <!--@if($module_info->layout_srl==$val->layout_srl)-->selected="selected"<!--@end-->>{$val->title} ({$val->layout})</option>
            <!--@end-->
            </select>
            <p>{$lang->about_layout}</p>
        </td>
    </tr>
    <!-- 모듈 스킨 옵션 -->
    <tr>
        <th scope="row">{$lang->skin}</th>
        <td>
            <select name="skin">
                <!--@foreach($skin_list as $key=>$val)-->
                <option value="{$key}" <!--@if($module_info->skin==$key ||(!$module_info->skin && $key=='xe_form'))-->selected="selected"<!--@end-->>{$val->title}</option>
                <!--@end-->
            </select>
            <p>{$lang->about_skin}</p>
        </td>
    </tr>
    <!-- 목록 수 -->
    <tr>
        <th scope="row"><div>{$lang->list_count}</div></th>
        <td>
            <input type="text" name="list_count" value="{$module_info->list_count?$module_info->list_count:20}"  class="inputTypeText" />
            <p>{$lang->about_list_count}</p>
        </td>
    </tr>
    <!-- 관리용 설명 -->
    <tr>
        <th scope="row">{$lang->description}</th>
        <td>
            <textarea name="description" class="inputTypeTextArea fullWidth">{htmlspecialchars($module_info->description)}</textarea>
            <p>{$lang->about_description}</p>
        </td>
    </tr>
    <!-- 모듈 상단 내용 -->
    <tr>
        <th scope="row">{$lang->header_text}</th>
        <td>
            <textarea name="header_text" class="inputTypeTextArea fullWidth" id="header_text">{htmlspecialchars($module_info->header_text)}</textarea>
            <a href="{getUrl('','module','module','act','dispModuleAdminLangcode','target','header_text')}" onclick="popopen(this.href);return false;" class="buttonSet buttonSetting"><span>{$lang->cmd_find_langcode}</span></a>
            <p>{$lang->about_header_text}</p>
        </td>
    </tr>
    <!-- 모듈 하단 내용 -->
    <tr>
        <th scope="row">{$lang->footer_text}</th>
        <td>
            <textarea name="footer_text" class="inputTypeTextArea fullWidth" id="footer_text">{htmlspecialchars($module_info->footer_text)}</textarea>
            <a href="{getUrl('','module','module','act','dispModuleAdminLangcode','target','footer_text')}" onclick="popopen(this.href);return false;" class="buttonSet buttonSetting"><span>{$lang->cmd_find_langcode}</span></a>
            <p>{$lang->about_footer_text}</p>
        </td>
    </tr>
    <!-- 등록 버튼 -->
    <tr>
        <th colspan="2" class="btnArea">
            <span class="btn"><input type="submit" value="{$lang->cmd_registration}" /></span>
        </th>
    </tr>
    </table>

</form>

 

캡처3.PNG

 

캡처4.PNG

 

네비 Lv. 3

댓글 3

  • php.ini에서 display_erros가 off로 되어있으면 on 해주세요.
    On으로 설정되어있음에도 백지만 뜰 경우 제 경험상 거의 ko.lang.php 파일에 문법 오류가 있는 경우였어요.

  • @제은일행
    헉 감사합니다 보니 off로 되어있었네요! ㅎ
  • @제은일행

    죄송합니다 ㅜㅜ 혹시 이에관한 문제도 알고계신가요??..

    프론트엔드 html에서 submit를누르면 컨트롤러로 넘어가지않고 새로고침만 되는현상... 

     

    캡처5.PNG

     

    캡처3.PNG

     

    캡처4.PNG

     

    왜 무한 새로고침이되는건지 잘모르겠습니다... 리다이렉트부분을 제거해도 그렇고 아에 콘솔에 "들어옴" 도찍히지않는걸보니 컨트롤러부분에 들어가질못하는거같은데... 아마도 예측하기엔 write.html 부분의 문제인거같은데 hidden으로 줘야할값들을 다준거같은데 왜이럴까요..