For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > June 2007 > Re: Parsing a php include (which also contains php code) - or "Reparsing"









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Parsing a php include (which also contains php code) - or "Reparsing"
J.O. Aho

2007-06-20, 7:58 am

Steven Borrelli wrote:
> Hello,
>
> I am using the <?php include() ?> statement on my website for
> organizational purposes. However, one of my includes contains some
> PHP code. Is there any way for the server to actually parse the
> include? I've tried this before, and it did not parse the include.
> Rather, it included the file as just plain ASCII.


If the main page is a php file, include will also make the included page to be
parsed by php.


I do suggest you use semicolon after each command, no matter if it's alone
between the php-tags or not.


It's always better to use .php as the file extension on the included files
too, this as .inc normally don't be set in the server to be parsed, which
leads to that if a person gives and url like

http://example.net/footer.inc

they will see the full source, and if you happen to have your database
login/password stored in the file, then they will know how to access it.


If you don't already, it's quite good to run apache web server and avoid iss.

--

//Aho
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com