Re: include problem



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
.



Relevant Pages

  • Re: include problem
    ... under that 2 folder and 1 file. ... under 'abc' has one file say 'index.php' ... systems don't have filesystems that supports symlinks). ... and now you could have the same relative paths in both index.php. ...
    (alt.php)
  • Re: The Disappearing Program?
    ... I now apply py2exe steps to produce an "executable" for abc. ... Somehow when I type abc at the command prompt, ... dist, and finds abc.exe, where it executes properly. ... py2exe creates a dist folder by default ...
    (comp.lang.python)
  • Re: What do you all do?
    ... Assembly ABC in the project folder ... use sw explorer to copy ABC to "ABC rev00" into the rev folder ... > I have Assembly-ABC ...
    (comp.cad.solidworks)
  • Re: Exchange 2k with Outlook 2k - need to display full destination add
    ... Folder a will receive e-mail from @def.com ... "Please do not send e-mail directly to this alias. ... >I have an Exchange 2k Server with users accessing it via Outlook 2k. ... > User: Abc ...
    (microsoft.public.exchange2000.admin)
  • Re: Multiple index.htmls
    ... File->New Web, browse to a different folder, say C:\XYZ ... FrontPage Support: http://www.frontpagemvps.com/ ... page for site ABC labeled as index.html. ... for site XYZ as index.html I am prompted there is already a file called ...
    (microsoft.public.frontpage.programming)