S

개행문자를 어떻게 없앨수 있을까요. nl2br 말구요..

게시판의 게시물,
 
그러니까. wr_content 필드에 들어가는
 
문자열의 개행문자를 제어하고 싶습니다.
 
 
해당 필드는 일반 게시판에서는 게시물의 내용이들어가는 부분이라서
 
db 차원에서 개행문자가 못들어가게 할 수는 없을거같구요.
 
 
제가 표현하고싶은 게시판에 , 게시물의 내용들이 줄바꿈이 일어나지 않고
 
나와야 합니다. 여러가지 방법을 써봤지만..
 
html 소스코드에서는 어김없이 줄바꿈이 되어있습니다.
 
\n 문자열도 지워봤는데 안되더군요.ㅠ_ㅠ
 
트랙벡 눌러보세요. 해당 페이지가 뜹니다....
 
 

댓글 4개

아마 javascript 에러가 날겁니다...ㅠ_ㅠ 스크롤링될 게시물의 제목에 줄바꿈이 있어서 에러가 나는 거죠.
php tip에 있는 rolo 님의 글인데요.
http://www.sir.co.kr/bbs/board.php?bo_table=pl_php&wr_id=322&sfl=&stx=&sst=wr_datetime&sod=desc&sop=and&page=2

위에 나와 있는,
$content=str_replace( "\r\n","",$content);
이 내용과 관련있는것 아닌지요...
아래 오달수님 팁을 참조하세요.

<?//=$view[content];?>

//오달수님 줄바꿈으로 생기는 불펼요한 상단여백 제거팁
//http://www.sir.co.kr/bbs/tb.php/g4_tiptech/1866
$Que_Vcontent=mysql_query("select wr_content from $write_table where wr_id ='$wr_id'");
$Vcontent= @mysql_result($Que_Vcontent,0,0);
if(!$html) {
$Vcontent = str_replace("<", "<", $Vcontent);
$Vcontent = str_replace(">", ">", $Vcontent);
$Vcontent = nl2br($Vcontent);
$Vcontent = stripslashes($Vcontent); //\제거
$Vcontent = str_replace("\t","        ",$Vcontent);
$Vcontent = str_replace(" "," ",$Vcontent);
}
else if($html==1) {
$Vcontent = str_replace("\n", "\n", $Vcontent);
$Vcontent = str_replace("¦", "\|", $Vcontent);
$Vcontent = str_replace("&", "&&", $Vcontent);
$Vcontent = str_replace( """, "\"",$Vcontent );
}
else if($html==2) {
$Vcontent = str_replace("\r", '',$Vcontent);
$Vcontent = preg_replace('/(?<!>)\n/', "<br />\n",$Vcontent);
}
echo $Vcontent;
걍 해당 스킨에만 개행 없에려면
view.skin.php에서
105번째 줄 <?=$view[content];?>

<?=$view[wr_content];?>이렇게 변경하면
되는걸로 알고 있네요.

$view[content]가 개행처리까지 완료한 거라서 그래요 ..

그러면 그전에 배열변수를 넣으면 되겠죠?

<?=$view[wr_content];?>

위에 분들의 말도 맞겠지만..
굳이 어려운 코드를 쓰는것보다 특정게시판 특별하게 사용하는거라면
소스 한줄 변경으로 가능할꺼에요.

참고하심 좋겠네요.
댓글을 작성하시려면 로그인이 필요합니다.

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

+
제목 글쓴이 날짜 조회
07-02-11 조회 1,658
07-02-11 조회 1,622
07-02-11 조회 3,042
07-02-11 조회 1,664
07-02-11 조회 1,645
07-02-11 조회 1,747
07-02-10 조회 2,413
07-02-10 조회 1,666
07-02-10 조회 1,607
07-02-10 조회 1,978
07-02-10 조회 1,694
07-02-10 조회 1,695
07-02-10 조회 1,591
07-02-10 조회 2,272
07-02-10 조회 1,668
07-02-10 조회 1,689
07-02-10 조회 1,599
07-02-10 조회 1,654
07-02-10 조회 1,653
07-02-10 조회 1,624