코멘트 줄바꿈수정 질문이요 ㅠㅠ

· 2013-09-10 (화) 01:20:16 · 1829 · 2
오류가 나는곳의 주소를 알려주시면 더 빠르고 정확하게 답변 받을 수 있습니다.

오류 주소 :

<!-- 코멘트 출력 -->
<div>
<?
$str = $list[$i][content];
if ($str == '비밀글 입니다.')
$str = "<span class='cloudy small'>$str</span>";
$str = preg_replace("/(\<img )([^\>]*)(\>)/i", "\\1 name='target_resize_image[]' onclick='image_window(this)' style='cursor:pointer;' \\2 \\3", $str);
echo $str;
$str = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp|mms)\:\/\/([^[:space:]]+)\.(mp3|wma|wmv|asf|asx|mpg|mpeg)\".*\<\/a\>\]/i", "<script>doc_write(obj_movie('$1://$2.$3'));</script>", $str);
$str = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp)\:\/\/([^[:space:]]+)\.(swf)\".*\<\/a\>\]/i", "<script>doc_write(flash_movie('$1://$2.$3'));</script>", $str);

?>
</div>
<? if ($list[$i][trackback]) { echo "<p>".$list[$i][trackback]."</p>"; } ?>
<span id='edit_<?=$comment_id?>' style='display:none;'></span><!-- 수정 -->
<span id='reply_<?=$comment_id?>' style='display:none;'></span><!-- 답변 --> </td>
</tr>
</table>
<? nl2br($list[$i][wr_content]); "<input type=hidden id='secret_comment_{$comment_id}' value='".strstr($list[$i][wr_option],"secret")."'>"; ?>

<table width=100% cellpadding=0 cellspacing=0>
<tr><td colspan=2 height=20></td></tr>
</table><textarea id='save_comment_<?=$comment_id?>' style='display:none;'><?=nl2br($list[$i][wr_content])?></textarea></td>
</tr>
</table>
<? } ?>
</div>

-----------------------------------------


<textarea id='save_comment_<?=$comment_id?>' style='display:none;'><?=nl2br($list[$i][wr_content])?></textarea>


이렇게 수정했는데도 줄바꿈이 되지않고 엔터 친부분이 그냥 띄어쓰기 되서 출력되는데
어디가 잘 못된건지 알 수있을까요??? ㅠㅠㅠㅠ 몇달째 혼자 앓고있는데 꼭 좀 답변 부탁드려요 ㅠㅠㅠㅠㅠㅠㅠㅠㅠ



|

댓글 2개

2013-09-10 (화) 07:41:36
첫번째 라인에서
$str = $list[$i][content];
위 부분을
$str=nl2br($list[$i]['content']);
로 바꿔보세요.
소스상 혹시 댓글부분도 에디터를 사용하시는지요? 태그허용댓글스타일이라,
자동줄바꿈에 대한 처리가 되어있지 않은 것 같기도 해서.
2013-09-10 (화) 11:52:05
<? nl2br($list[$i][wr_content]); "<input type=hidden id='secret_comment_{$comment_id}' value='".strstr($list[$i][wr_option],"secret")."'>"; ?> 를

<?php echo 혹은 <?= 로 변경해주셔야 하구요.

<textarea><?=$list[$i]['wr_content'];?></textarea>



자스에서

$("#save_comment_<?=$comment_id?>").html().replace('\n', '<br>'); 해주심 될듯 한데요.
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

66,531건

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
13-09-10 조회 1,636
13-09-10 조회 1,269
13-09-10 조회 1,545
13-09-10 조회 2,111
13-09-10 조회 1,643
13-09-10 조회 892
13-09-10 조회 1,715
13-09-10 조회 1,620
13-09-10 조회 1,845
13-09-10 조회 1,614
13-09-10 조회 2,443
13-09-10 조회 982
13-09-10 조회 837
13-09-10 조회 1,199
13-09-10 조회 1,931
13-09-10 조회 1,066
13-09-10 조회 1,059
13-09-10 조회 2,283
13-09-10 조회 880
13-09-10 조회 1,830