Re: include problem
- From: "J.O. Aho" <user@xxxxxxxxxxx>
- Date: Sun, 09 Jul 2006 09:13:58 +0200
Sukalyan wrote:
Hi!
I have a problem when i go for include any page.
I am trying to explane that
1. let, I am working under a folder 'www'
2. under that 2 folder and 1 file.
folder's are say 'abc', 'include'
file is 'index.php'
3. under 'abc' has one file say 'index.php'
4. under 'include' has 4 file whose are included correctly with
'index.php' under 'www'
5. when I try to include that with 'index.php' under 'abc' I need to
change every link within 'include' header file or rewrite a new header
file for 'abc' folder
is it possible that just changing index file of 'abc' include location
work correctly.
When you include something without the full path in PHP, it's always the main page relation to other files that you have to think of.
If file include/1.php includes file include/2.php, you have to use the full path: include('/var/www/html/main/include/2.php');
Better can be to let the index files to include things, so for index.php it would be:
include('include/1.php');
include('include/2.php');
include('include/3.php');
include('include/4.php');
in abc/index.php it would be:
include('../include/1.php');
include('../include/2.php');
include('../include/3.php');
include('../include/4.php');
another easy way to fix the paths is to use symlinks (some quite bad operating systems don't have filesystems that supports symlinks).
cd abc
ln -s ../include
then you would have in abc:
file: index.php
symlink: include
and now you could have the same relative paths in both index.php.
//Aho
.
- Follow-Ups:
- Re: include problem
- From: l3vi501
- Re: include problem
- References:
- include problem
- From: Sukalyan
- include problem
- Prev by Date: Re: newbie - variable to string
- Next by Date: Re: newbie - variable to string
- Previous by thread: include problem
- Next by thread: Re: include problem
- Index(es):
Relevant Pages
|