document 출력 문제

editor.php

  1. <div class="kboard-attr-row44">
  2.    <label class="attr-name" ><?php echo __('근무시간', 'kboard')?></label>
  3.    <div class="attr-value">
  4.     <select name="s_time1">
  5.      <option value="1"<?php if($content->option->s_time1 == '01:00'):?> selected<?php endif?>><?php echo __('01:00', 'kboard')?></option>
  6.      <option value="2"<?php if($content->option->s_time1 == '02:00'):?> selected<?php endif?>><?php echo __('02:00', 'kboard')?></option>
  7.      <option value="3"<?php if($content->option->s_time1 == '03:00'):?> selected<?php endif?>><?php echo __('03:00', 'kboard')?></option>
  8.      <option value="4"<?php if($content->option->s_time1 == '04:00'):?> selected<?php endif?>><?php echo __('04:00', 'kboard')?></option>
  9.      <option value="5"<?php if($content->option->s_time1 == '05:00'):?> selected<?php endif?>><?php echo __('05:00', 'kboard')?></option>
  10.      <option value="6"<?php if($content->option->s_time1 == '06:00'):?> selected<?php endif?>><?php echo __('06:00', 'kboard')?></option>
  11.      <option value="7"<?php if($content->option->s_time1 == '07:00'):?> selected<?php endif?>><?php echo __('07:00', 'kboard')?></option>
  12.      <option value="8"<?php if($content->option->s_time1 == '08:00'):?> selected<?php endif?>><?php echo __('08:00', 'kboard')?></option>
  13.      <option value="9"<?php if($content->option->s_time1 == '09:00'):?> selected<?php endif?>><?php echo __('09:00', 'kboard')?></option>
  14.      <option value="10"<?php if($content->option->s_time1 == '10:00'):?> selected<?php endif?>><?php echo __('10:00', 'kboard')?></option>
  15.      <option value="11"<?php if($content->option->s_time1 == '11:00'):?> selected<?php endif?>><?php echo __('11:00', 'kboard')?></option>
  16.      <option value="12"<?php if($content->option->s_time1 == '12:00'):?> selected<?php endif?>><?php echo __('12:00', 'kboard')?></option>
  17.      <option value="13"<?php if($content->option->s_time1 == '13:00'):?> selected<?php endif?>><?php echo __('13:00', 'kboard')?></option>
  18.      <option value="14"<?php if($content->option->s_time1 == '14:00'):?> selected<?php endif?>><?php echo __('14:00', 'kboard')?></option>
  19.      <option value="15"<?php if($content->option->s_time1 == '15:00'):?> selected<?php endif?>><?php echo __('15:00', 'kboard')?></option>
  20.      <option value="16"<?php if($content->option->s_time1 == '16:00'):?> selected<?php endif?>><?php echo __('16:00', 'kboard')?></option>
  21.      <option value="17"<?php if($content->option->s_time1 == '17:00'):?> selected<?php endif?>><?php echo __('17:00', 'kboard')?></option>
  22.      <option value="18"<?php if($content->option->s_time1 == '18:00'):?> selected<?php endif?>><?php echo __('18:00', 'kboard')?></option>
  23.      <option value="19"<?php if($content->option->s_time1 == '19:00'):?> selected<?php endif?>><?php echo __('19:00', 'kboard')?></option>
  24.      <option value="20"<?php if($content->option->s_time1 == '20:00'):?> selected<?php endif?>><?php echo __('20:00', 'kboard')?></option>
  25.      <option value="21"<?php if($content->option->s_time1 == '21:00'):?> selected<?php endif?>><?php echo __('21:00', 'kboard')?></option>
  26.      <option value="22"<?php if($content->option->s_time1 == '22:00'):?> selected<?php endif?>><?php echo __('22:00', 'kboard')?></option>
  27.      <option value="23"<?php if($content->option->s_time1 == '23:00'):?> selected<?php endif?>><?php echo __('23:00', 'kboard')?></option>
  28.      <option value="24"<?php if($content->option->s_time1 == '24:00'):?> selected<?php endif?>><?php echo __('24:00', 'kboard')?></option>
  29.     </select>
  30.     <select name="wordpress_time2">
  31.      <option value="1"<?php if($content->search == '01:00'):?> selected<?php endif?>><?php echo __('01:00', 'kboard')?></option>
  32.      <option value="2"<?php if($content->search == '02:00'):?> selected<?php endif?>><?php echo __('02:00', 'kboard')?></option>
  33.      <option value="3"<?php if($content->search == '03:00'):?> selected<?php endif?>><?php echo __('03:00', 'kboard')?></option>
  34.      <option value="4"<?php if($content->search == '04:00'):?> selected<?php endif?>><?php echo __('04:00', 'kboard')?></option>
  35.      <option value="5"<?php if($content->search == '05:00'):?> selected<?php endif?>><?php echo __('05:00', 'kboard')?></option>
  36.      <option value="6"<?php if($content->search == '06:00'):?> selected<?php endif?>><?php echo __('06:00', 'kboard')?></option>
  37.      <option value="7"<?php if($content->search == '07:00'):?> selected<?php endif?>><?php echo __('07:00', 'kboard')?></option>
  38.      <option value="8"<?php if($content->search == '08:00'):?> selected<?php endif?>><?php echo __('08:00', 'kboard')?></option>
  39.      <option value="9"<?php if($content->search == '09:00'):?> selected<?php endif?>><?php echo __('09:00', 'kboard')?></option>
  40.      <option value="10"<?php if($content->search == '10:00'):?> selected<?php endif?>><?php echo __('10:00', 'kboard')?></option>
  41.      <option value="11"<?php if($content->search == '11:00'):?> selected<?php endif?>><?php echo __('11:00', 'kboard')?></option>
  42.      <option value="12"<?php if($content->search == '12:00'):?> selected<?php endif?>><?php echo __('12:00', 'kboard')?></option>
  43.      <option value="13"<?php if($content->search == '13:00'):?> selected<?php endif?>><?php echo __('13:00', 'kboard')?></option>
  44.      <option value="14"<?php if($content->search == '14:00'):?> selected<?php endif?>><?php echo __('14:00', 'kboard')?></option>
  45.      <option value="15"<?php if($content->search == '15:00'):?> selected<?php endif?>><?php echo __('15:00', 'kboard')?></option>
  46.      <option value="16"<?php if($content->search == '16:00'):?> selected<?php endif?>><?php echo __('16:00', 'kboard')?></option>
  47.      <option value="17"<?php if($content->search == '17:00'):?> selected<?php endif?>><?php echo __('17:00', 'kboard')?></option>
  48.      <option value="18"<?php if($content->search == '18:00'):?> selected<?php endif?>><?php echo __('18:00', 'kboard')?></option>
  49.      <option value="19"<?php if($content->search == '19:00'):?> selected<?php endif?>><?php echo __('19:00', 'kboard')?></option>
  50.      <option value="20"<?php if($content->search == '20:00'):?> selected<?php endif?>><?php echo __('20:00', 'kboard')?></option>
  51.      <option value="21"<?php if($content->search == '21:00'):?> selected<?php endif?>><?php echo __('21:00', 'kboard')?></option>
  52.      <option value="22"<?php if($content->search == '22:00'):?> selected<?php endif?>><?php echo __('22:00', 'kboard')?></option>
  53.      <option value="23"<?php if($content->search == '23:00'):?> selected<?php endif?>><?php echo __('23:00', 'kboard')?></option>
  54.      <option value="24"<?php if($content->search == '24:00'):?> selected<?php endif?>><?php echo __('24:00', 'kboard')?></option>
  55.     </select>
  56.     <select name="wordpress_apm">
  57.      <option value="1"<?php if($content->search == '주간'):?> selected<?php endif?>><?php echo __('주간', 'kboard')?></option>
  58.      <option value="2"<?php if($content->search == '야간'):?> selected<?php endif?>><?php echo __('야간', 'kboard')?></option>
  59.      <option value="3"<?php if($content->search == '격일'):?> selected<?php endif?>><?php echo __('격일', 'kboard')?></option>
  60.     </select>
  61.    </div>
  62.   </div>

 

document.php

ex1>

  1. <div class="content-view">
  2.      <?php if($board->isEditor($content->member_uid)):?>
  3.      <p>
  4.       <?php echo __('근무시간', 'kboard')?> : <?php echo $content->option->s_time1?><br>
  5.      </p>
  6.      <?php endif?>
  7.      
  8.      <?php echo $content->content?>
  9.     </div>

ex2>

  1.     <div class="detail-attr detail-writer">
  2.      <div class="detail-name"><?php echo $content->option->s_time1?></div>
  3.     </div>

 

document의 출력이 안되옵니다. 정상 출력이라면 ex1 ex2 둘다 옵션벨류의 값인 숫자 1~ 24까지가 출력이 되는게 맞을것 같은데... 뭐가 문제일가요...

 

워드프레스 에러 기술지원 서비스 전문가에게 맡기세요
좋은 정보와 인맥을 동시에, 워드프레스 사용자 단톡방 참여하기
  • option 의 경우 if 문으로 체크하기 때문입니다.

    <option value="01:00"<?php if($content->option->s_time1 == '01:00'):?> selected<?php endif?>>1시입니다</option>

     

    아래와 같이 체크하는게 없다면 상관없겠죠.

    <input type="text" name="kboard_option_s_time1" value="<?php echo $content->option->s_time1?>">

     

    value 값은 강제는 아닙니다.

    if 문 등 php 프로그램을 다루실 줄 안다면 적절히 활용하시면 됩니다^^

  • 아래 예제를 참고해서 몇몇 부분을 수정해주세요.

    <select name="kboard_option_s_time1">
         <option value="01:00"<?php if($content->option->s_time1 == '01:00'):?> selected<?php endif?>>01:00</option>

    <select name="kboard_option_time2">
         <option value="01:00"<?php if($content->option->time2 == '01:00'):?> selected<?php endif?>>01:00</option>

    <select name="kboard_option_apm">
         <option value="주간"<?php if($content->option->apm == '주간'):?> selected<?php endif?>>주간</option>

     

    값 출력은 아래와 같습니다.

    <p>근무시간 : <?php echo $content->option->s_time1?></p>

    <p>근무시간2 : <?php echo $content->option->time2?></p>

    <p>APM : <?php echo $content->option->apm?></p>

     

    s_time1, time2, apm 등 옵션 필드의 이름은 제한이 없으며 형식만 일정하게 맞춰주시면 됩니다.

    또한 필드의 value 값도 실제 출력값을 입력을 해주셔야 합니다.

     

    저장은 kboard_option_{name} 필드 name을 이런 형식으로,

    출력은 <?php echo $content->option->{name}?> 이런 형식입니다.

     

    입력필드 추가하는 방법은 블로그에도 나와있습니다 ㅎㅎ

    http://blog.naver.com/chan2rrj/50173560012

  • 감사합니다. 항상 질문 올리기 죄송해서.. 커뮤니티 뒤져보고.. 블로그도 그페이지는 즐찾 되잇어요... ㅠㅠ

    엉뚱하게 kboard_option을 배재하고 생각 햇네요.........벨류값 자체는 임의지정해도 되는거로 기억하는데 우측의 속성값이라고 해야하나요? 그것과 왜 동일 해야 한다는거죠???

  • 많은 도움 되엇고 이해 햇습니당. 감사합니다!

좋은 정보와 인맥을 동시에, 워드프레스 사용자 단톡방 참여하기