|
Posted by Hilarion on 09/05/05 21:29
WeeWillyTonka <WeeWillyTonka@hotmail.com> wrote:
> It seems to be when I format the link as <?
> include("http://somesite.ru/ipaddress/index.php") ?>
> is ok if formated like this <? include("ipaddress/index.php") ?> .
You should never use URLs when including local files. (Maybe "never" is
not a good word here, but you'll have to have very strong arguments
and reasons to use URLs instead local paths when refering to local
scripts.)
When you use "include" instruction and pass it an URL, then the PHP
engine makes HTTP request to the webserver, which executes the PHP
script and returns it to the PHP, which includes the result (HTML probably)
into your script.
When you use "include" instruction and pass it a path to a script,
then PHP engine reads the file, includes it into your current script
and continues execution from the start of this file as if it was
part of the including script. No HTTP request is made.
In the first method you have no access to included script variables,
superglobals or functions (nor the included script has to including script
ones). In the first method the incuding script host is the caller
of the included one, so the included one sees the including host IP
instead of the oryginal (including file) caller IP.
> So now all I ave to do is work out how to link all the sub folders to it .
What do you mean by "link subfolders"? What is your folders and files
structure? Do you want to know how to include scripts located in different
folders, or how to include some script from different folders, or how
to include scripts from a script which was included by another script
located in unknown (from the included script perspective) folder?
You'll have to choose between absolute paths, relative paths or mixing both,
but will have to remember (especialy with absolute paths), that those are
filesystem paths (which are a bit different that web paths).
Hilarion
Navigation:
[Reply to this message]
|