|
Posted by Steven Borrelli on 06/23/07 04:32
On Jun 22, 10:18 am, "J.O. Aho" <u...@example.net> wrote:
> Steven Borrelli wrote:
> > When you say the PHP includes have nothing to do with the web server,
> > that is somewhat confusing.
>
> The web server won't load the included files, it won't have a clue what has
> been included, as this is handled by the PHP parser module.
>
> > If I have my index.php, and I have a call to a php include within
> > that, and also another php include within the first include, and all
> > the includes have the .php file extension, will everything be parsed
> > and appear like it's supposed to?
>
> The extension has nothing to do with if the file will be parsed or not, but of
> "security" reasons it's vise to set the php extension to the include files too.
>
> When you include a php script, see to that the PHP code in that file has the
> '<?PHP' and '?>' tags, or else the php code will be treated as plain text.
>
> example:
>
> --- file1.inc.php ---
> <?PHP
> echo "Hello";
> ?>
> --- eof ---
>
> --- file2.inc.php ---
> echo "Hello";
> --- eof ---
>
> --- index.php ---
> <html><head><title>php include test</title></head><body>
> First include: <?PHP include 'file1.inc.php'; ?><br>
> Second include: <?PHP include 'file2.inc.php'; ?><br>
> </body></html>
> --- eof ---
>
> If you run this small example you will notice that the output will look like this:
>
> First include: Hello
> Second include: echo "Hello";
>
> > In other words, is it possible to make nesting php includes?
>
> Sure you can, there is no problems with that at all and it's justed quite a
> lot on the most big projects you can find (see freshmeat.net).
>
> --
>
> //Aho
That makes sense now. Thanks so much Aho, ... and everyone else too!
Steven
[Back to original message]
|