Hi,
I have 3 files [config.php ; include.php; page.php].
config.php:
<? $cfg_Html_Dir = "http://wwww.domain.com/includes/"; ?>
include.php:
<?
print "Pageheader<br>";
print $cfg_Html_Dir;
?>
page.php:
<? require_once ($DOCUMENT_ROOT . "config.php");
<body>
<? include $cfg_Html_Dir . "include.php"; ?>
<p> Page contents!
<br> print $cfg_Html_Dir; // This line always work!
</body>
Now I open page.php
Obviously you would aspect to get as result:
Pageheader
http://www.domain.com/includes
Page contents!
http://www.domain.com/includes
But the weirdest thing happen!
The output is:
Pageheader
Page contents!
http://www.domain.com/includes
When I change page.php into:
<? require_once ($DOCUMENT_ROOT . "config.php");
<body>
<? include "http://www.domain.com/includes/include.php"; ?>
<p> Page contents!
<br> print $cfg_Html_Dir; // This line always work!
</body>
The output actually is:
Pageheader
http://www.domain.com/includes
Page contents!
http://www.domain.com/includes
My question is ... how can this happen ?!
It seems to me that when I use a variable with the include-statement
that the variable nor other variables from config.php no longer exists!
I would say: try it and see for yourself!
Patrick
Don't ask why I want to do or use this, but it seems pretty weird to me.
Does anyone has an explenation?