php include headache
Posted: Thu Aug 03, 2006 8:26 am
Hi All,
Recently I use php to develop a site with many subfolders. I mostly do the backend and two designers do the frontend using dreamweaver.
The site directory kind of like
/
/include/tpl.header.php
/images/header.gif
/student/class/2006.php
/student/info.php
/index.php
In the tpl.header.php file, i have code like <img src= "../images/header.gif"></img>
Then here's the catch:
In the info.php file, if I wrote: include_once("../include/tpl.header.php"); I can see the image when i open it in the browser.
But, in the index.php, if I wrote include_once("./include/tpl.header.php"); Then I can't see the image...
Also, in the 2006.php file, when I wrote include_once("../../include/tpl.header.php"); I can't see the image also...
How do I provide a good fix for this problem, since the site is growing bigger and bigger, so in the student/class/ folder, it will have more and more files later, but I wish to display the header.gif in every one of those files.
What should I do? What's the best solution?
With my best,
Jim
Recently I use php to develop a site with many subfolders. I mostly do the backend and two designers do the frontend using dreamweaver.
The site directory kind of like
/
/include/tpl.header.php
/images/header.gif
/student/class/2006.php
/student/info.php
/index.php
In the tpl.header.php file, i have code like <img src= "../images/header.gif"></img>
Then here's the catch:
In the info.php file, if I wrote: include_once("../include/tpl.header.php"); I can see the image when i open it in the browser.
But, in the index.php, if I wrote include_once("./include/tpl.header.php"); Then I can't see the image...
Also, in the 2006.php file, when I wrote include_once("../../include/tpl.header.php"); I can't see the image also...
How do I provide a good fix for this problem, since the site is growing bigger and bigger, so in the student/class/ folder, it will have more and more files later, but I wish to display the header.gif in every one of those files.
What should I do? What's the best solution?
With my best,
Jim