hi!
problem explanation:
in my root directory i have the 'header.php' file which has two image tags, these images are stored in a directory named images in the same root dir.
header.php:
<div id="header">
<table width="100%" >
<tr>
<td class="logo">
<img src="images/logo.png" height=80 width=90>
</td>
<td class="title">
<img src="images/title.png" height="80" width="300"/>
</td>
</tr>
</table>
</div>
the header looks fine in the 'index.php' page of the root dir. now i created a directory called 'users' within the root dir in which i created a file called 'new_user.php'. here i included the 'header.php' file, but it shows only a thin background. the images are not visible.
directory structure:
root
|_images
| |_logo.png
|
|_users
| |_new_user.php
|
|_header.php
|_index.php
i suppose it is because it cannot access the images folder from within the users folder.
is there any way i could use some path variable to solve this problem?
PLZ suggest a solution
problem using 'include' file: path not working!
Moderator: General Moderators
Re: problem using 'include' file: path not working!
header.php:
index.php:
new_user.php:
try that.
Code: Select all
div id="header">
<table width="100%" >
<tr>
<td class="logo">
<img src="<?php echo $path; ?>/logo.png" height=80 width=90>
</td>
<td class="title">
<img src="<?php echo $path; ?>/title.png" height="80" width="300"/>
</td>
</tr>
</table>
</div>
Code: Select all
<?php
$path="images";
include 'header.php';
?>
Code: Select all
<?php
$path="../../images";
include 'header.php';
?>
Re: problem using 'include' file: path not working!
Thanx a lot DeFacto! it works great 