- 1
- 260578
- 조회 수 791
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | <header> <div id= "screen" ></div> <!-- 헤더 부분. --> <div class = 'navbar' > <ul class = "nav" > <li class = "lit" ><a href= "index.php" >ByWiki</a></li> <li id= "sidenav" > <a href= "#" id= "sidenav-toggle" >☰</a> <nav id= "sidenav-menu" > <header id= "sidenav-header" > <span id= "close-sidenav" >×</span> <div>메뉴</div> </header> <ul> <li><a href= "board.html" >게시판</a></li> <li><a href= 'index.php?return=도움말' >도움말</a></li> </ul> </nav> </li> <li id= "searchbox" class = "til" ><form action= "search.php" method= "post" target= "m_view" ><input type= "text" name= "name" class = "searchtext" placeholder= "검색.." /> <input type= "image" src= "img\search.png" ></form></li> </ul> </div> </header> <section id= "contents" > <div id= "main" > <!-- 콘텐츠가 보여질 부분. --> <div class = "view" > <section id= "m_main" > <span class = "tbar" > <ul> <li> <form action= "history.php" method= "post" > <input type= "hidden" name= "hist" value= "<?php echo $name;?>" /> <input type= "image" src= "img/history.png" > </form> </li> <li> </li> <li> <form action= "do.php" method= "post" > <input type= "hidden" name= "less" value= "<?php echo $name;?>" /> <input type= "image" src= "img/Editing-edit-icon.png" > </form> </li> </ul> </span> <span id= "d" > <h1><?php echo $name ;?></h1> <hr class = "title" > <div id= "article" ><?php include nl2br ( "d/$name.html" , false); ?></div> </span> </section> </div> </div> </section> <footer> <div id= "bottom" > <!-- 푸터 부분.--> <div class = "footer" > <a class = "footer" target= "m_view" href= "LICENSE" >9.74 With Bywiki.</a> </div> </div> </footer> |
줄바꿈이 처리되지 않습니다. 어떻게 해야할까요?
include 함수의 인자는 파일 내용이 아니라 파일명 이므로, 당연히 nl2br 은 적용되지 않습니다.
<?php
// HTML 파일의 including만 가능합니다. PHP 문법은 파싱하지 않아요.
function
include_html_nl2br(
$path
){
$contents
=
file_get_contents
(
$path
);
print
(
str_replace
(
"\n"
,
base64_decode
(
'PGJyIC8+'
),
$contents
));
return
;
}