For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > July 2005 > including file and output to browser









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 including file and output to browser
Michael G

2005-07-30, 3:59 am

I am not sure I understand the rules as to what exactly gets output to a
browser and when. If I include a text only file or an html file, these will
show up in the browser regardless of where in the script they are included.

Thanks,
Mike



----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Michael Phipps

2005-07-30, 3:59 am

>I am not sure I understand the rules as to what exactly gets output to a
>browser and when.


To make things easier, lets assume you aren't using output buffering.

a PHP file gets read top to bottom.

If while reading one PHP file the parser comes across an included file, that
file will be read top to bottom and then continue from where it left off in
the original script.

> If I include a text only file or an html file, these will show up in the
> browser regardless of where in the script they are included.


They will be output to the browser at whatever point you put them in the
script.

Why do you ask anyhow? Some code might make it easier to explain why you
are experiencing a particular problem.

Michael


Michael G

2005-07-30, 8:59 am


"Michael Phipps" <gravityspike_spamfree_@optusnet.com.au> wrote in message
news:42eb0b77$0$18132$afc38c87@news.optusnet.com.au...
> Why do you ask anyhow? Some code might make it easier to explain why you
> are experiencing a particular problem.
>


Well, my web applications are starting to more like standalone apps because
I have been using OO and the web version of MVC. Each request involves a
number of objects, so to the reader it doesn't look like a single script,
yet it is. Since MVC does such a nice job of separation, the template that
actually gets pushed out to the browser is an 'include' in a method call in
a View/Template class.

Mike



----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Sponsored Links







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

Copyright 2010 codecomments.com