You are here: Re: Parsing a php include (which also contains php code) - or "Reparsing" the php file « PHP Language « IT news, forums, messages
Re: Parsing a php include (which also contains php code) - or "Reparsing" the php file

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

 

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

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