안녕하세요.
http://www.cosmosfarm.com/threads/document/10819?page=8
위 글을 보고 글작성 시 자동으로 카테고리가 선택되게 수정 하였습니다.
최초 글작성 시에는 정상 동작 하나 해당 글을 수정하면
카테고리가 없어져 미분류로 이동 됩니다.
해당 부분은 어떻게 수정 하면될 지 조언 부탁 드립니다.
감사합니다.
아래 코드로 변경해보시겠어요?
<?php if($board->isAdmin()):?>
<?php if($board->use_category):?>
<?php if($board->initCategory1()):?>
<div class="kboard-attr-row">
<label class="attr-name" for="kboard-select-category1">승인상태</label>
<div class="attr-value">
<select id="kboard-select-category1" name="category1">
<option value=""><?php echo __('Category', 'kboard')?> <?php echo __('Select', 'kboard')?></option>
<?php while($board->hasNextCategory()):?>
<option value="<?php echo $board->currentCategory()?>"<?php if($content->category1 == $board->currentCategory()):?> selected<?php endif?>><?php echo $board->currentCategory()?></option>
<?php endwhile?>
</select>
</div>
</div>
<?php endif?>
<?php endif?>
<?php if($board->initCategory2()):?>
<div class="kboard-attr-row">
<label class="attr-name" for="kboard-select-category2"><?php echo __('Category', 'kboard')?>2</label>
<div class="attr-value">
<select id="kboard-select-category2" name="category2">
<option value=""><?php echo __('Category', 'kboard')?> <?php echo __('Select', 'kboard')?></option>
<?php while($board->hasNextCategory()):?>
<option value="<?php echo $board->currentCategory()?>"<?php if($content->category2 == $board->currentCategory()):?> selected<?php endif?>><?php echo $board->currentCategory()?></option>
<?php endwhile?>
</select>
</div>
</div>
<?php endif?>
<?php else:?>
<input type="hidden" name="category1" value="<?php echo $content->category1?$content->category1:'승인요청'?>">
<input type="hidden" name="category2" value="<?php echo $content->category2?$content->category2:''?>">
<?php endif?>
작성자가 수정 시 카테고리 선택이 없어집니다.
관리자의 경우 카테고리가 보이기 때문에 정상적이구요.
카테고리1에는 승인요청, 승인완료 두가지이며 자동으로 승인요청이 선택되게 해두었습니다.
코드는 아래와 같습니다.
-------------------------------------------------------------------------
<?php if($board->use_category):?>
<?php if($board->isAdmin()):?>
<?php if($board->initCategory1()):?>
<div class="kboard-attr-row">
<label class="attr-name" for="kboard-select-category1">승인상태</label>
<div class="attr-value">
<select id="kboard-select-category1" name="category1">
<option value=""><?php echo __('Category', 'kboard')?> <?php echo __('Select', 'kboard')?></option>
<?php while($board->hasNextCategory()):?>
<option value="<?php echo $board->currentCategory()?>"<?php if($content->category1 == $board->currentCategory()):?> selected<?php endif?>><?php echo $board->currentCategory()?></option>
<?php endwhile?>
</select>
</div>
</div>
<?php endif?>
<?php endif?>
<?php if($board->initCategory2()):?>
<div class="kboard-attr-row">
<label class="attr-name" for="kboard-select-category2"><?php echo __('Category', 'kboard')?>2</label>
<div class="attr-value">
<select id="kboard-select-category2" name="category2">
<option value=""><?php echo __('Category', 'kboard')?> <?php echo __('Select', 'kboard')?></option>
<?php while($board->hasNextCategory()):?>
<option value="<?php echo $board->currentCategory()?>"<?php if($content->category2 == $board->currentCategory()):?> selected<?php endif?>><?php echo $board->currentCategory()?></option>
<?php endwhile?>
</select>
</div>
</div>
<?php endif?>
<?php else:?>
<?php if(!$content->category1):?>
<input type="hidden" name="category1" value="승인요청">
<?php endif?>
<?php endif?>
누가 수정시에 카테고리 선택이 없어지는지요?
관리자가 수정하면? 글쓴이가 수정하면?
적용하신 코드를 올려주시겠어요?