|
Posted by "Richard Lynch" on 07/22/05 09:04
On Wed, July 20, 2005 1:04 pm, Matt Darby said:
> babu wrote:
>
>>It will become a big mess up for me if i combine all the files as they
>> are large files.
Scenario #1:
Use include/require to suck in the files, when needed.
Scenario #2:
Use header("Location: ") to re-direct the browser to another file.
In both scenarios, the server has to load the second file from the hard
drive.
In both scenarios, the files are "separate" for code-maintenance purposes.
In #2, however you are *WASTING* an HTTP response, forcing the browser to
use an extra HTTP connection, and essentially *DOUBLING* the "load" on
your Apache server.
If you have any kind of state data of any size, you will have to maintain
it in session and/or db and then re-create it in the second HTTP exchange,
so that's even MORE overhead.
I have *NEVER* understood why this is considered "standard" practice in
PHP scripts.
I doubt that I ever will understand why it's so prevalent.
I can think of very few instances where a simple "include" doesn't make
more sense from a structured code point of view.
In fact, except for documents that actually *HAVE* moved and you want the
browser and any intermediate caches notified of that fact, I can't think
of any other cases where header("Location: ") is better than "include"...
Unless the resource doesn't actually "live" on your server, and it's doing
some kind of brokering or load-balancing or something...
--
Like Music?
http://l-i-e.com/artists.htm
Navigation:
[Reply to this message]
|