I have a webpage with this structure:
/var/www/html/webpage/
|-stands/
. |-header.php
.
|-images/
. |-picture.png
.
|-login/
. |-login.php
.
|-index.php
I'd like to use the stands/header.php in both files, the login/login.php and the index.php. I included it in both files with
<?php
include("stands/header.php")
?>
or
<?php
include("../stands/header.php")
?>
This works fine until header.php uses a graphic from images/ folder like images/picture.png.
I use the picture as follows in the header.php:
<img src="../images/picture.png" alt="nice pic"/>
I get the picture.png in the login.php file but in the index.php i get nice pic.
It seems like, if I include the header.php file the directory where it looks for the picture starts not at the directory of the header.php but from the directory where it is included (e.g. from index.php, it looks in the 2nd parent directory of index.php which is html/ (because of the ../ and there is no images/ folder, so I get nice pic instead of the .png file.
My question now is:
Is there a way to include graphics global, means that it always (always) looks for the same directory?
Thanks for any help and sorry for my bad structured question (I'm not English and don't know how to ask this more simple)
webpage?