You are here: Includes with muli-level directories « PHP Programming Language « IT news, forums, messages
Includes with muli-level directories

Posted by FP on 10/06/19 11:50

I have the following files;
\A.php
\F1\B.php
\F1\F1_1\C.php

File A has the lines "echo 'A'; include_once('F1/B.php');"
File B has the lines "echo 'B'; include_once('F2/C.php');"
File C has the line "echo 'C';"

If I open file A in my browser I get "ABC".
If I open file B in my browser I get "BC".
So far so good.


I also have files;
\D.php
\F1\E.php
\F1\F1_1\F.php

File D has the lines "echo 'D'"
File E has the lines "echo 'E'; include_once('../D.php');"
File F has the line "echo 'F'; include_once('../E.php');"

If I open file E in my browser I get "ED".
If I open file F in my browser I get "FE" and an error saying file D
doesn't exist.
If I change the include portion of file E to '../../D.php' then I get
"FED".

Is this how PHP is suppose to work?
I have several files at the root level including a "SetupData.php" file
in which I need to specify IPs, passwords etc.
I have a directory "FX" and the file "ImageProxy.php" inside it.
The "ImageProxy.php" file is used as an include by files at the root
level but also called directly.
The "ImageProxy.php" file requires passwords stored in the
"SetupData.php" file.
How do I get the "ImageProxy.php" file to access the variables in the
"SetupData.php" file?
As far as I can tell it's possible to include a file by full path, if
possible I would like to avoid that, are there any other ways?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация