채택완료

추가여분필드 문의드려요

2017-08-02 (수) 14:13:08 2,499

추가여분필드를 에디터로 변경하여 사용하고있는데요

write페이지에서 파일추가부분에 for문 돌려서 에디터도 파일추가한 갯수만큼 생성되었는데

에디터안에 내용이 출력이 안되네요

<?php echo editor_html("wr_1", $write['wr_1'], $is_dhtml_editor); ?>

이 부분을 

<?php echo editor_html("wr_$i", $write['wr_$i'], $is_dhtml_editor); ?>

로 변경해서 사용하려고 하는데 안되는데 다른방법이 있을까요..?

답변 2개 / 댓글 1개

채택된 답변
+20 포인트

답변에 대한 댓글 1개

이거보구 참조한건데요
<?php for ($i=0; $is_file && $i<$file_count; $i++) { ?>
<tr>
<th scope="row">파일<?php echo $i+1 ?></th>
<td>
<input type="file" name="bf_file[]" title="파일첨부 <?php echo $i+1 ?> : 용량 <?php echo $upload_max_filesize ?> 이하만 업로드 가능" class="frm_file frm_input">
<?php if ($is_file_content) { ?>
<input type="text" name="bf_content[]" value="<?php echo ($w == 'u') ? $file[$i]['bf_content'] : ''; ?>" title="파일 설명을 입력해주세요." class="frm_file frm_input" size="50">
<?php } ?>
<?php if($w == 'u' && $file[$i]['file']+1) { ?>
<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>
<?php } ?>
</td>
<td><label for="" style="width:100px; height:150"><?php echo $file[$i]['view']; ?></label></td>
</tr>

<tr>
<th scope="row"><label for="wr_<?php echo $i;?>">에디터<?php echo $i+1 ?></label></th>
<td class="wr_content"><?php echo editor_html("wr_1", $write['wr_1'], $is_dhtml_editor); ?></td>
<td></td>
</tr>

<?php } ?>
위에 질문처럼 for문안에 파일추가 사이에 넣은거라..
wr_1로 하면 나오는데 제가 하고싶은 방법은 wr_$i인데.. 이 $i가 안먹어서요..다른방법이 있을까해서요

정말 무식한 방법으로 해결했습니다ㅠㅠ

for문안에

<?

$tmp = "wr_";

$tmp2 = $i+1;

$tmp3 =  $tmp."". $tmp2;

?>

이렇게 선언해주고

에디터 출력시 

<tr> 

<th scope="row"><label for="<?$tmp3?>">에디터<?php echo $i+1 ?></label></th> 

<td class="wr_content"><?php echo editor_html($tmp3, $write[$tmp3], $is_dhtml_editor); ?></td> 

<td></td>

</tr>

이렇게 해줬더니 나오네요ㅠㅠ

답변을 작성하려면 로그인이 필요합니다.