첨부파일 설명 하나더 채택완료
첨부파일 설명 보이기후
write_update.php에서
bf_content = '{$bf_content[$i]}', 밑에
bf_content2 = '{$bf_content2[$i]}',
이런식으로 추가하고
db필드도 추가했습니다.
그리고
write.skkin.php에서
아래와 같이 사용중입니다.
</p>
<p>
</p>
<p><?php for ($i=0; $is_file && $i<=$file['count'];$i++) { ?></p>
<p> <div class="addpic"></p>
<p> </p>
<p> <?php if($w == 'u' && $file[$i]['file']) { ?>
<div class="pic">
<!--첨부사진 보이기/-->
<?php
$file = get_file($bo_table, $wr_id);
$image = urlencode($file[$i]['file']);
$image_path = G5_DATA_PATH.'/file/'.$bo_table;
$image_url = G5_DATA_URL.'/file/'.$bo_table;
if (preg_match("/\.(gif|jpg|jpeg|png)$/i", $image)) {
$thumb = thumbnail($image, $image_path , $image_path , 100, 100, false, true);
$image_content = $image_url.'/'.$thumb;
echo "<img src=".$image_content.">";
}
?>
</div>
<div class="txt">
<input type="file" name="bf_file[]" title="사진첨부 <?php echo $i+1 ?> : 용량 <?php echo $upload_max_filesize ?> 이하만 업로드 가능" class="frm_file frm_input file" style="display:inline-block;">
<input type="text" name="bf_content[]" value="<?php echo ($w == 'u') ? $file[$i]['bf_content'] : ''; ?>" title="사진 설명을 입력해주세요." class="frm_file_content frm_input explain">
<input type="text" name="bf_content2[]" value="<?php echo ($w == 'u') ? $file[$i]['bf_content2'] : ''; ?>" title="사진 설명을 입력해주세요." class="frm_file_content frm_input explain">
<input type="checkbox" id="bf_file_del<?php echo $i ?>" name="bf_file_del[<?php echo $i; ?>]" value="1"> <label for="bf_file_del<?php echo $i ?>"><?php echo $file[$i]['source'].'('.$file[$i]['size'].')'; ?> 사진 삭제</label>
</div>
<!--/첨부사진 보이기-->
<?php } ?>
</div>
<?php if ($i==0) { ?>
<button type="button" class="btn_frmline fwzadd addpic">사진추가</button>
<?php } ?></p>
<p> <?php } ?></p>
<p>
input에 값넣고 글쓰기시 DB에 값 저장은 잘되는데
수정시에는
bf_content[] 값만 불러와지고
bf_content2[] 값은 안불러와지는데
왜 그럴까요?
답변 2개
for문 언의 get_file을 삭제하세요
저렇게 for문 내에서 이미지 하나 출력할때마다 매번 불러오는 것이 아닙니다
lib/common.lib.php --> get-file 함수를 수정만 하면 됩니다
$bf_content = ~~다음행에 동일한 방법으로 bf_content2 추가
$bf_content2 = $row['bf_content2'] ? html_purifier($row['bf_content2']) : '';
$file[$no]['content'] = get_text($bf_content); <--- 다음행에 추가
$file[$no]['content2'] = get_text($bf_content2);
그리고 질문 코드처럼 $file[$i][bf_content] 하지말고 $file[$i]['content'] , $file[$i]['content2'] 사용
====================
이런 문제가 생길때마다 get_file을 어디서 불러오는지 get_file함수가 어떻게 생겼는지 소스를 찾아보세요
저 소스를 보면 이렇게 추가하면 되겠구나하고 알게 될 것입니다
그렇게 해야 그누보드 사용법을 익히게 되고 실력이 늘지 이렇게 답변만으로 해결하면
10년이 지나도 그누보드 제대로 사용 못합니다
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인