I am a jsp programmer who has taken up a little homework to learn php on my own 😉
So my question is on including files in php document.
To Explain here is the code.
index.php
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Home</title>
</head>
<body>
<?php include("/php/lib/banner.php"); ?>
</body>
</html>
banner.php
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Banner</title>
</head>
<body>
<table width="100%">
<tr>
<td>
<img src="../../images/banner.jpg" width="100%" /></td>
</tr>
</table>
</body>
</html>
file locations :
main\index.php
main\php\lib\banner.php
main\images\banner.jpg
The error I get is that no image is displayed in Index page, but it works when I directly access banner.php
Please suggest.
Regards
Sworoop Mahapatra
Include literally puts the contents of one file into the other, so you want the path to be the path you would use in index.php (images/banner.jpg)