<?include"/dot_slide.htm";?>
본문
index.html 작성중입니다. 테이블안쪽에 <?include"/dot_slide.htm";?>를 넣어도 동작하지 않습니다
왜 이럴까요?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
</style>
<script type="text/javascript">
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
</script>
</head>
<body>
<table width="100%" bg background="new/bg.jpg" height="100%"border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="top"><table width="800" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1127"><img src="new/top.jpg" width="980" height="120" /></td>
</tr>
<tr>
<td valign="top"><table width="980" height="339" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"><?include"/dot_slide.htm";?></td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="new/footer.jpg" width="980" height="165" /></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
답변 1
include 는 서버의 실제 경로 기준으로 적용됩니다.
/dot_slide.htm 이라고 하면 해당 서버의 최상위 루트 디렉토리(폴더)를 가리키게 됩니다.
절대경로로 한다면..
include $_SERVER['DOCUMENT_ROOT'] . "/dot_slide.htm";
상대경로로 한다면
include "./dot_slide.htm";
또는 include "dot_slide.htm"; 으로 작성하면 됩니다. (index.html 과 같은 경로에 있을시)
그리고 include 다음에는 띄어쓰기가 들어가야 됩니다.
<?php include "./dot_slide.htm"; ?>
답변을 작성하시기 전에 로그인 해주세요.